From 89f797ee0e8b8106c5e2c1dc76d15d2a3823de60 Mon Sep 17 00:00:00 2001
From: lcode <18046109718@163.com>
Date: Sat, 12 Oct 2024 18:45:51 +0800
Subject: [PATCH] =?UTF-8?q?20241012=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
appengine/pom.xml | 6 ++
.../service/common/CommonServices.java | 83 +++++++++++++++---
.../现有库存量/列表仓库产品.ms | 86 +++++++++++--------
.../现有库存量/列表仓库物料.ms | 73 ++++++++--------
.../供应商资料管理/列表.ms | 4 +-
.../供应商资料管理/删除.ms | 4 +-
.../供应商资料管理/新增.ms | 42 +++++++--
.../基础/下拉/关联表下拉.ms | 14 ++-
.../生产管理/产品入库表/列表.ms | 4 +-
.../生产管理/产品入库表/新增.ms | 6 +-
.../生产管理/产品入库表/详情.ms | 23 +++--
.../生产管理/工序报工表/新增.ms | 11 ++-
.../生产管理/挤压排产表/修改.ms | 71 +++++++++++----
.../生产管理/挤压排产表/列表.ms | 28 +++---
.../生产管理/挤压排产表/新增.ms | 52 ++++++-----
.../生产管理/挤压排产表/详情.ms | 68 +++++++++++++++
.../计划挤压排产管理/列表.ms | 36 ++++----
.../计划挤压排产管理/新增.ms | 16 +++-
.../计划挤压排产管理/详情.ms | 6 +-
.../采购管理/采购订单管理/新增.ms | 10 ++-
.../销售管理/客户资料管理/列表.ms | 3 +-
.../销售管理/客户资料管理/新增.ms | 40 ++++++++-
.../销售管理/销售出货管理/详情.ms | 4 +-
.../销售管理/销售订单管理/修改.ms | 18 ++--
.../销售管理/销售订单管理/列表.ms | 4 +-
.../销售管理/销售订单管理/新增.ms | 25 ++++--
.../api/小程序端API/测试/测试.ms | 13 ++-
.../api_file/function/公共/公共sql.ms | 37 +++++++-
.../src/main/resources/application-local.yml | 6 +-
29 files changed, 573 insertions(+), 220 deletions(-)
create mode 100644 appengine/src/main/resources/api_file/api/web管理端API/生产管理/挤压排产表/详情.ms
diff --git a/appengine/pom.xml b/appengine/pom.xml
index 4f666a7..0e179f1 100644
--- a/appengine/pom.xml
+++ b/appengine/pom.xml
@@ -340,6 +340,12 @@
3.6.5
+
+
+ com.belerweb
+ pinyin4j
+ 2.5.0
+
diff --git a/appengine/src/main/java/com/currency/appengine/service/common/CommonServices.java b/appengine/src/main/java/com/currency/appengine/service/common/CommonServices.java
index e4498c7..4944fb6 100644
--- a/appengine/src/main/java/com/currency/appengine/service/common/CommonServices.java
+++ b/appengine/src/main/java/com/currency/appengine/service/common/CommonServices.java
@@ -5,6 +5,7 @@ import com.currency.appengine.mapper.common.CommonMapper;
import com.currency.appengine.service.user.impl.UserServiceImpl;
import com.currency.appengine.utils.LockUtils;
import com.currency.appengine.utils.date.DateUtil;
+import net.sourceforge.pinyin4j.PinyinHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -12,6 +13,7 @@ import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
+import java.util.Objects;
import java.util.function.Function;
@Service
@@ -21,6 +23,12 @@ public class CommonServices {
@Autowired
CommonMapper commonMapper;
+ /**
+ * 获取编码
+ * @param type
+ * @param data
+ * @return
+ */
public String getCode(String type, Map data) {
Map,String>> grantTypeMap = new HashMap<>();
@@ -50,8 +58,17 @@ public class CommonServices {
public String customerCode(Map params) {
try {
return LockUtils.doWithLock(() -> {
- int count = commonMapper.count("mini_customer_info", null, null);
- return "C" + formatNumber(count, "5");
+// int count = commonMapper.count("mini_customer_info", null, null);
+ Map map = commonMapper
+ .findOne("select * from mini_customer_info where code_auto=1 order by id desc", null);
+
+ String customerCode = "C0";
+ if (Objects.nonNull(map.get("customerCode"))) {
+ customerCode = String.valueOf(map.get("customerCode"));
+ }
+
+ Integer number = Integer.parseInt(customerCode.replace("C", "")) + 1;
+ return "C" + formatNumber(number, "5");
});
} catch (Exception e) {
return null;
@@ -66,8 +83,18 @@ public class CommonServices {
public String supplierCode(Map params) {
try {
return LockUtils.doWithLock(() -> {
- int count = commonMapper.count("mini_supplier_info", null, null);
- return "V" + formatNumber(count, "5");
+// int count = commonMapper.count("mini_supplier_info", null, null);
+// return "V" + formatNumber(count, "5");
+ Map map = commonMapper
+ .findOne("select * from mini_supplier_info where code_auto=1 order by id desc", null);
+
+ String supplierCode = "V0";
+ if (Objects.nonNull(map.get("supplierCode"))) {
+ supplierCode = String.valueOf(map.get("supplierCode"));
+ }
+
+ Integer number = Integer.parseInt(supplierCode.replace("V", "")) + 1;
+ return "V" + formatNumber(number, "5");
});
} catch (Exception e) {
return null;
@@ -80,8 +107,16 @@ public class CommonServices {
* @return
*/
public String salesOrderNumber(Map params) {
-
- return null;
+ try {
+ return LockUtils.doWithLock(() -> {
+ String customerName = String.valueOf(params.get("customerName"));
+ String customerNamePY = toPinyinFirstLetter(customerName).toUpperCase();
+ int count = commonMapper.count("mini_sales_orders", "date(create_time) = curdate()", null);
+ return customerNamePY + DateUtil.getYyyyMMdd() + "-" + formatNumber(count, "3");
+ });
+ } catch (Exception e) {
+ return null;
+ }
}
/**
@@ -90,8 +125,15 @@ public class CommonServices {
* @return
*/
public String orderNumber(Map params) {
-
- return null;
+ try {
+ return LockUtils.doWithLock(() -> {
+ String documentNumber = String.valueOf(params.get("documentNumber"));
+ Integer index = Integer.valueOf(String.valueOf(params.get("index")));
+ return documentNumber.substring(documentNumber.length() - 3) + formatNumber(index, "2");
+ });
+ } catch (Exception e) {
+ return null;
+ }
}
/**
@@ -127,15 +169,15 @@ public class CommonServices {
}
/**
- * 生成排产单号为JY+日期流水号+3位流水
+ * 生成报工单号为BG+日期流水号+3位流水
* @param params
* @return
*/
public String productionOrderNumber(Map params) {
try {
return LockUtils.doWithLock(() -> {
- int count = commonMapper.count("mini_extrusion_schedule", "date(create_time) = curdate()", null);
- return "JY" + DateUtil.getYyyyMMdd() + formatNumber(count, "3");
+ int count = commonMapper.count("mini_process_report", "date(create_time) = curdate()", null);
+ return "BG" + DateUtil.getYyyyMMdd() + formatNumber(count, "3");
});
} catch (Exception e) {
return null;
@@ -162,10 +204,23 @@ public class CommonServices {
return String.format("%0" + digit + "d", number);
}
+ public static String toPinyinFirstLetter(String chinese) {
+ StringBuilder pinyinFirstLetters = new StringBuilder();
+ for (char c : chinese.toCharArray()) {
+ String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(c);
+ if (pinyinArray != null) {
+ pinyinFirstLetters.append(pinyinArray[0].charAt(0));
+ } else {
+ pinyinFirstLetters.append(c);
+ }
+ }
+ return pinyinFirstLetters.toString();
+ }
public static void main(String[] arg) {
- int sequenceNumber = 123456; // 假设这是你的序号
- String formattedSequence = String.format("%05d", sequenceNumber);
- System.out.println(formattedSequence); // 输出:00123
+// int sequenceNumber = 123456; // 假设这是你的序号
+// String formattedSequence = String.format("%05d", sequenceNumber);
+// System.out.println(formattedSequence); // 输出:00123
+ System.out.println(toPinyinFirstLetter("你好").toUpperCase());
}
}
diff --git a/appengine/src/main/resources/api_file/api/web管理端API/仓储管理/现有库存量/列表仓库产品.ms b/appengine/src/main/resources/api_file/api/web管理端API/仓储管理/现有库存量/列表仓库产品.ms
index 8a80840..e7c3b91 100644
--- a/appengine/src/main/resources/api_file/api/web管理端API/仓储管理/现有库存量/列表仓库产品.ms
+++ b/appengine/src/main/resources/api_file/api/web管理端API/仓储管理/现有库存量/列表仓库产品.ms
@@ -5,7 +5,7 @@
"groupId" : "40879f3a602c40e493f0b273de9fc01e",
"name" : "列表仓库产品",
"createTime" : null,
- "updateTime" : 1726399986194,
+ "updateTime" : 1728714345936,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@@ -47,46 +47,56 @@
}
================================
-String warehouse = body.warehouse;
+String customerName = body.customerName;
String materialCode = body.materialCode;
+String materialName = body.materialName;
+String profileModel = body.profileModel;
+String warehouse = body.warehouse;
+String salesOrderCode = body.salesOrderCode;
return db.page("""
select
- sales_order_code,
- material_code,
- material_name,
- profile_model,
- weight,
- specification,
- thickness,
- pieces_bundle,
- material_category,
- default_length,
- packaging_method,
- source,
- unit,
- order_length,
- order_total_quantity,
- surface_method,
- theoretical_weight_per_piece,
- theoretical_weight,
- packing_quantity,
- date_format(delivery_date, '%Y-%m-%d %H:%i:%S') as delivery_date,
- customer_material_code,
- produced_pieces,
- produced_length,
- price_with_tax,
- amount_with_tax,
- remark,
- shipmentsed_number,
- returned_number,
- unit_price,
- order_no,
- existing_inventory,
- customer_id,
- warehouse
- from mini_warehouse_product
+ mwp.sales_order_code,
+ mwp.material_code,
+ mwp.material_name,
+ mwp.profile_model,
+ mwp.weight,
+ mwp.specification,
+ mwp.thickness,
+ mwp.pieces_bundle,
+ mwp.material_category,
+ mwp.default_length,
+ mwp.packaging_method,
+ mwp.source,
+ mwp.unit,
+ mwp.order_length,
+ mwp.order_total_quantity,
+ mwp.surface_method,
+ mwp.theoretical_weight_per_piece,
+ mwp.theoretical_weight,
+ mwp.packing_quantity,
+ date_format(mwp.delivery_date, '%Y-%m-%d %H:%i:%S') as delivery_date,
+ mwp.customer_material_code,
+ mwp.produced_pieces,
+ mwp.produced_length,
+ mwp.price_with_tax,
+ mwp.amount_with_tax,
+ mwp.remark,
+ mwp.shipmentsed_number,
+ mwp.returned_number,
+ mwp.unit_price,
+ mwp.order_no,
+ mwp.existing_inventory,
+ mwp.customer_id,
+ mwp.warehouse,
+ mci.customer_name
+ from mini_warehouse_product mwp
+ left join mini_customer_info mci on mci.customer_code = mwp.customer_id
where 1=1
- ?{warehouse!= null and warehouse !="", and warehouse=#{warehouse}}
- ?{materialCode!= null and materialCode !="", and material_code=#{materialCode}}
+ ?{customerName!= null and customerName != "", and mci.customer_name like concat('%', #{customerName}, '%')}
+ ?{materialCode != null and materialCode != "", and mwp.material_code like concat('%', #{materialCode}, '%') }
+ ?{materialName != null and materialName != "", and mwp.material_name like concat('%', #{materialName}, '%') }
+ ?{profileModel != null and profileModel != "", and mwp.profile_model like concat('%', #{profileModel}, '%') }
+ ?{warehouse != null and warehouse != "", and mwp.warehouse = #{warehouse} }
+ ?{salesOrderCode != null and salesOrderCode != "", and mwp.sales_order_code like concat('%', #{salesOrderCode}, '%') }
""");
\ No newline at end of file
diff --git a/appengine/src/main/resources/api_file/api/web管理端API/仓储管理/现有库存量/列表仓库物料.ms b/appengine/src/main/resources/api_file/api/web管理端API/仓储管理/现有库存量/列表仓库物料.ms
index da9f8d1..7dda4f2 100644
--- a/appengine/src/main/resources/api_file/api/web管理端API/仓储管理/现有库存量/列表仓库物料.ms
+++ b/appengine/src/main/resources/api_file/api/web管理端API/仓储管理/现有库存量/列表仓库物料.ms
@@ -5,7 +5,7 @@
"groupId" : "40879f3a602c40e493f0b273de9fc01e",
"name" : "列表仓库物料",
"createTime" : null,
- "updateTime" : 1726399787648,
+ "updateTime" : 1728715379207,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@@ -47,44 +47,45 @@
}
================================
-String isProduct = isProduct;
-String warehouse = body.warehouse;
-String supplier = body.supplier;
String materialCode = body.materialCode;
+String materialName = body.materialName;
+String profileModel = body.profileModel;
+String warehouse = body.warehouse;
return db.page("""
select
- id,
- material_code,
- material_name,
- profile_model,
- weight,
- specification,
- thickness,
- pieces_bundle,
- material_category,
- default_length,
- packaging_method,
- source,
- unit,
- remarks,
- theoretical_weight,
- actual_weight,
- supplier_net_weight,
- unit_price,
- amount,
- tax_rate,
- price_with_tax,
- amount_with_tax,
- pricing_method,
- existing_inventory,
- supplier,
- warehouse,
- create_by,
- pieces
- from mini_warehouse_material
+ mwm.id,
+ mwm.material_code,
+ mwm.material_name,
+ mwm.profile_model,
+ mwm.weight,
+ mwm.specification,
+ mwm.thickness,
+ mwm.pieces_bundle,
+ mwm.material_category,
+ mwm.default_length,
+ mwm.packaging_method,
+ mwm.source,
+ mwm.unit,
+ mwm.remarks,
+ mwm.theoretical_weight,
+ mwm.actual_weight,
+ mwm.supplier_net_weight,
+ mwm.unit_price,
+ mwm.amount,
+ mwm.tax_rate,
+ mwm.price_with_tax,
+ mwm.amount_with_tax,
+ mwm.pricing_method,
+ mwm.existing_inventory,
+ mwm.supplier,
+ mwm.warehouse,
+ mwm.create_by,
+ mwm.pieces
+ from mini_warehouse_material mwm
where 1=1
- ?{warehouse!= null and warehouse !="", and warehouse=#{warehouse}}
- ?{supplier!= null and supplier !="", and supplier=#{supplier}}
- ?{materialCode!= null and materialCode !="", and material_code=#{materialCode}}
+ ?{materialCode != null and materialCode != "", and mwm.material_code like concat('%', #{materialCode}, '%') }
+ ?{materialName != null and materialName != "", and mwm.material_name like concat('%', #{materialName}, '%') }
+ ?{profileModel != null and profileModel != "", and mwm.profile_model like concat('%', #{profileModel}, '%') }
+ ?{warehouse != null and warehouse != "", and mwm.warehouse = #{warehouse} }
""");
\ No newline at end of file
diff --git a/appengine/src/main/resources/api_file/api/web管理端API/供应商资料管理/列表.ms b/appengine/src/main/resources/api_file/api/web管理端API/供应商资料管理/列表.ms
index 23c65e8..2580432 100644
--- a/appengine/src/main/resources/api_file/api/web管理端API/供应商资料管理/列表.ms
+++ b/appengine/src/main/resources/api_file/api/web管理端API/供应商资料管理/列表.ms
@@ -5,7 +5,7 @@
"groupId" : "d13d50f1c9af4220979e387ad95c1f9b",
"name" : "列表",
"createTime" : null,
- "updateTime" : 1724464450074,
+ "updateTime" : 1728651484719,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@@ -53,7 +53,7 @@ String contactPerson = body.contactPerson;
String status = body.status;
var sql = """
- select id, supplier_name, settlement_currency, tax, is_tax_included, contact_phone, address, contact_person, status, remarks, create_by, date_format(create_time, '%Y-%m-%d %H:%i:%S') as create_time
+ select id, supplier_code, supplier_name, settlement_currency, tax, is_tax_included, contact_phone, address, contact_person, status, remarks, create_by, date_format(create_time, '%Y-%m-%d %H:%i:%S') as create_time
from mini_supplier_info
where 1 = 1
?{supplierName != null and supplierName != '', and supplier_name like concat('%', #{supplierName}, '%')}
diff --git a/appengine/src/main/resources/api_file/api/web管理端API/供应商资料管理/删除.ms b/appengine/src/main/resources/api_file/api/web管理端API/供应商资料管理/删除.ms
index ca4337d..5d0fa2b 100644
--- a/appengine/src/main/resources/api_file/api/web管理端API/供应商资料管理/删除.ms
+++ b/appengine/src/main/resources/api_file/api/web管理端API/供应商资料管理/删除.ms
@@ -5,7 +5,7 @@
"groupId" : "d13d50f1c9af4220979e387ad95c1f9b",
"name" : "删除",
"createTime" : null,
- "updateTime" : 1726040144872,
+ "updateTime" : 1728652181152,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@@ -58,6 +58,6 @@ if (Objects.nonNull(type) && "batch".equals(type)) {
""");
} else {
return db.update("""
- ddelete from mini_supplier_info where id = #{id}
+ delete from mini_supplier_info where id = #{id}
""");
}
\ No newline at end of file
diff --git a/appengine/src/main/resources/api_file/api/web管理端API/供应商资料管理/新增.ms b/appengine/src/main/resources/api_file/api/web管理端API/供应商资料管理/新增.ms
index d2fd971..4c6a8fb 100644
--- a/appengine/src/main/resources/api_file/api/web管理端API/供应商资料管理/新增.ms
+++ b/appengine/src/main/resources/api_file/api/web管理端API/供应商资料管理/新增.ms
@@ -5,7 +5,7 @@
"groupId" : "d13d50f1c9af4220979e387ad95c1f9b",
"name" : "新增",
"createTime" : null,
- "updateTime" : 1724482009990,
+ "updateTime" : 1728652483911,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@@ -25,10 +25,10 @@
"expression" : null,
"children" : null
} ],
- "requestBody" : "",
+ "requestBody" : "{\r\n \"supplierCode\": \"\",\r\n \"isAuto\": true,\r\n \"supplierName\": \"sd22\",\r\n \"settlementCurrency\": \"CNY\",\r\n \"tax\": \"tax1\",\r\n \"isTaxIncluded\": 0,\r\n \"contactPhone\": \"\",\r\n \"address\": \"\",\r\n \"contactPerson\": \"\",\r\n \"status\": 1,\r\n \"remarks\": \"\"\r\n}",
"headers" : [ {
"name" : "authorization",
- "value" : null,
+ "value" : "5E34C0D7EA601026B93C26119C7E1AD57BDC4F4DD7836B6F883430E388E7D8A0704B7E0E35AAA6410EEFECDD2A2E5988",
"description" : "登录token",
"required" : false,
"dataType" : "String",
@@ -46,6 +46,12 @@
"responseBodyDefinition" : null
}
================================
+
+import 'commonServices' as CommonServices
+
+Boolean isAuto = body.isAuto; // 是否自动生成编码 1-自动生成 0-非自动生成
+
+String supplierCode = body.supplierCode;
String supplierName = body.supplierName;
String settlementCurrency = body.settlementCurrency;
String tax = body.tax;
@@ -59,6 +65,30 @@ String userId = StringUtil.objectToString(request.get().getAttribute("openid"));
// 查询数据库获取对应 userId 的用户名
String createBy = db.selectOne("""SELECT user_name FROM sys_user WHERE user_id = #{userId}""").userName;
-return db.insert("""
-insert into mini_supplier_info(supplier_name, settlement_currency, tax, is_tax_included, contact_phone, address, contact_person, status, remarks, create_by ) values(#{supplierName}, #{settlementCurrency}, #{tax}, #{isTaxIncluded}, #{contactPhone}, #{address}, #{contactPerson}, #{status}, #{remarks}, #{createBy} )
-""");
\ No newline at end of file
+Map map = db.selectOne("select * from mini_supplier_info where supplier_name=#{supplierName}")
+if (map != null) {
+ exit -1, "供应商已存在!"
+}
+
+if (isAuto) {
+ // 自动生成编码
+ supplierCode = CommonServices.getCode("SupplierCode", null)
+}
+
+return db.table("mini_supplier_info").insert({
+ code_auto: isAuto,
+ supplier_code: supplierCode,
+ supplier_name: supplierName,
+ settlement_currency: settlementCurrency,
+ tax: tax,
+ is_tax_included: isTaxIncluded,
+ contact_phone: contactPhone,
+ address: address,
+ contact_person: contactPerson,
+ status: status,
+ remarks: remarks
+})
+
+// return db.insert("""
+// insert into mini_supplier_info(supplier_name, settlement_currency, tax, is_tax_included, contact_phone, address, contact_person, status, remarks, create_by ) values(#{supplierName}, #{settlementCurrency}, #{tax}, #{isTaxIncluded}, #{contactPhone}, #{address}, #{contactPerson}, #{status}, #{remarks}, #{createBy} )
+// """);
\ No newline at end of file
diff --git a/appengine/src/main/resources/api_file/api/web管理端API/基础/下拉/关联表下拉.ms b/appengine/src/main/resources/api_file/api/web管理端API/基础/下拉/关联表下拉.ms
index 6d11581..c3d540b 100644
--- a/appengine/src/main/resources/api_file/api/web管理端API/基础/下拉/关联表下拉.ms
+++ b/appengine/src/main/resources/api_file/api/web管理端API/基础/下拉/关联表下拉.ms
@@ -5,7 +5,7 @@
"groupId" : "13ae727775794bbf8ce3cf71bfe5feef",
"name" : "关联表下拉",
"createTime" : null,
- "updateTime" : 1727704108834,
+ "updateTime" : 1728701598542,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@@ -180,12 +180,20 @@ var config = {
"where": " status = 1 ",
"orderBy": ""
},
+ // 机台
+ "production_machines": {
+ "table": "mini_production_machines",
+ "value": "machine_code",
+ "label": "machine_name",
+ "where": " status = 1 ",
+ "orderBy": ""
+ },
// 客户
"customer_info": {
"custom": true,
"sql": """
- select concat_ws('', mci.id) as value, mci.customer_name as label, md.dictionary as tax from mini_customer_info mci
- left join mini_dictionary md on md.code = mci.tax and md.`type` = 'tax' where mci.status = 1
+ select mci.customer_code as value, mci.customer_name as label, cast(replace(md.dictionary, '%', '') as decimal(10, 2)) * 0.01 as tax from mini_customer_info mci
+ left join mini_dictionary md on md.code = mci.tax and md.`type` = 'tax' where mci.status = 1 and mci.customer_code is not null
"""
},
"surface_methods": {
diff --git a/appengine/src/main/resources/api_file/api/web管理端API/生产管理/产品入库表/列表.ms b/appengine/src/main/resources/api_file/api/web管理端API/生产管理/产品入库表/列表.ms
index d98af5b..8e882dc 100644
--- a/appengine/src/main/resources/api_file/api/web管理端API/生产管理/产品入库表/列表.ms
+++ b/appengine/src/main/resources/api_file/api/web管理端API/生产管理/产品入库表/列表.ms
@@ -5,7 +5,7 @@
"groupId" : "4aa6b5de02c244e2981c22bf5a95394d",
"name" : "列表",
"createTime" : null,
- "updateTime" : 1726399750667,
+ "updateTime" : 1728712962029,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@@ -59,7 +59,7 @@ return db.page("""
mpr.total_weight,
mpr.remarks
from mini_product_receipt mpr
- left join mini_customer_info mci on mci.id = mpr.customer_id
+ left join mini_customer_info mci on mci.customer_code = mpr.customer_id
where 1=1
?{documentNumber!=null && documentNumber!="", and mpr.document_number like concat('%', #{documentNumber} ,'%') } group by mpr.document_number
""");
\ No newline at end of file
diff --git a/appengine/src/main/resources/api_file/api/web管理端API/生产管理/产品入库表/新增.ms b/appengine/src/main/resources/api_file/api/web管理端API/生产管理/产品入库表/新增.ms
index dbc4916..a7d3062 100644
--- a/appengine/src/main/resources/api_file/api/web管理端API/生产管理/产品入库表/新增.ms
+++ b/appengine/src/main/resources/api_file/api/web管理端API/生产管理/产品入库表/新增.ms
@@ -5,7 +5,7 @@
"groupId" : "4aa6b5de02c244e2981c22bf5a95394d",
"name" : "新增",
"createTime" : null,
- "updateTime" : 1726398617960,
+ "updateTime" : 1728712359983,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@@ -58,11 +58,11 @@ try{
List list = new ArrayList();
materialsList.map(marerial => {
list.add({
- sales_order_number: marerial.salesOrderNumber,
+ sales_order_code: marerial.salesOrderCode,
material_code: marerial.materialCode,
document_number: orderInfo.documentNumber,
receipt_date: orderInfo.receiptDate,
- customerId: orderInfo.customerId,
+ customer_id: orderInfo.customerId,
workshop: orderInfo.workshop,
frame_number: orderInfo.frameNumber,
total_weight: orderInfo.totalWeight,
diff --git a/appengine/src/main/resources/api_file/api/web管理端API/生产管理/产品入库表/详情.ms b/appengine/src/main/resources/api_file/api/web管理端API/生产管理/产品入库表/详情.ms
index f01498e..d0a3952 100644
--- a/appengine/src/main/resources/api_file/api/web管理端API/生产管理/产品入库表/详情.ms
+++ b/appengine/src/main/resources/api_file/api/web管理端API/生产管理/产品入库表/详情.ms
@@ -5,7 +5,7 @@
"groupId" : "4aa6b5de02c244e2981c22bf5a95394d",
"name" : "详情",
"createTime" : null,
- "updateTime" : 1726394692471,
+ "updateTime" : 1728712748680,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@@ -24,38 +24,35 @@
================================
import '@/common/sql' as sql
-String warehouseMaterial = sql("warehouseMaterial")
+String salesOrder = sql("salesOrder")
String documentNumber = body.documentNumber;
return {
orderInfo: db.selectOne("""
select
document_number,
- receipt_date,
- customer,
+ date_format(receipt_date, '%Y-%m-%d') as receipt_date,
+ customer_id,
workshop,
frame_number,
total_weight,
remarks
from mini_product_receipt
where 1=1
- ?{documentNumber!=null && documentNumber!="", and document_number like concat('%', #{documentNumber} ,'%') } group by document_number
+ and document_number=#{documentNumber} group by document_number
"""),
materials: db.select("""
select
mpr.document_number,
- mpr.sales_order_number,
- mpr.material_code
- mpr.receipt_warehouse,
mpr.receipt_quantity,
- mpr.packaging_quantity,
+ mpr.packing_quantity,
mpr.actual_weight,
mpr.unstocked_quantity,
mpr.stocked_quantity,
- ${warehouseMaterial}
- from mini_product_receipt mso
- left join mini_sales_orders mso on mso.sales_order_number = mpr.sales_order_number
- and mwm.material_code = mmr.material_code
+ ${salesOrder}
+ from mini_product_receipt mpr
+ left join mini_sales_order_materials msm on msm.sales_order_code = mpr.sales_order_code
+ and msm.material_code = mpr.material_code
where 1=1
and mpr.document_number = #{documentNumber}
"""),
diff --git a/appengine/src/main/resources/api_file/api/web管理端API/生产管理/工序报工表/新增.ms b/appengine/src/main/resources/api_file/api/web管理端API/生产管理/工序报工表/新增.ms
index 7ee0041..51a3df1 100644
--- a/appengine/src/main/resources/api_file/api/web管理端API/生产管理/工序报工表/新增.ms
+++ b/appengine/src/main/resources/api_file/api/web管理端API/生产管理/工序报工表/新增.ms
@@ -5,7 +5,7 @@
"groupId" : "06bb1cef20924ed8887b1c3ae8a91d3a",
"name" : "新增",
"createTime" : null,
- "updateTime" : 1726372031701,
+ "updateTime" : 1728723877581,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@@ -46,6 +46,8 @@
"responseBodyDefinition" : null
}
================================
+import 'commonServices' as CommonServices
+
Map orderInfo = body.orderInfo;
List materialsList = body.materials
@@ -53,11 +55,18 @@ String userId = StringUtil.objectToString(request.get().getAttribute("openid"));
// 查询数据库获取对应 userId 的用户名
String createBy = db.selectOne("""SELECT user_name FROM sys_user WHERE user_id = #{userId}""").userName;
+if (orderInfo.isAuto) {
+ // 自动生成编码
+ orderInfo.reportNumber = CommonServices.getCode("ProductionOrderNumber", orderInfo)
+}
+
+
var tx = db.transaction(); //开启事务
try{
int res = db.table("mini_process_report").insert({
schedule_number: materialsList.get(0).scheduleNumber,
report_number: orderInfo.reportNumber,
+ code_auto: orderInfo.isAuto,
machine: orderInfo.machine,
operator: orderInfo.operator,
workshop: orderInfo.workshop,
diff --git a/appengine/src/main/resources/api_file/api/web管理端API/生产管理/挤压排产表/修改.ms b/appengine/src/main/resources/api_file/api/web管理端API/生产管理/挤压排产表/修改.ms
index c0f0596..f21fb8d 100644
--- a/appengine/src/main/resources/api_file/api/web管理端API/生产管理/挤压排产表/修改.ms
+++ b/appengine/src/main/resources/api_file/api/web管理端API/生产管理/挤压排产表/修改.ms
@@ -4,8 +4,8 @@
"script" : null,
"groupId" : "f4b3acf704cf4db29258ba70e24f8fc5",
"name" : "修改",
- "createTime" : 1725173227511,
- "updateTime" : null,
+ "createTime" : null,
+ "updateTime" : 1728727443545,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@@ -25,10 +25,10 @@
"expression" : null,
"children" : null
} ],
- "requestBody" : "",
+ "requestBody" : "{\r\n \"materials\": [\r\n {\r\n \"id\": 1677,\r\n \"documentNumber\": \"BG20241012002\",\r\n \"plannedPieces\": 1,\r\n \"remarks\": \"\",\r\n \"salesDate\": \"2024-10-18\",\r\n \"customerName\": \"测试44\",\r\n \"salespersonName\": \"超级管理员\",\r\n \"price\": null,\r\n \"pricingDate\": 1730304000000,\r\n \"taxRate\": \"0.09\",\r\n \"processingFee\": null,\r\n \"orderNo\": \"00501\",\r\n \"salesOrderCode\": \"CS4420241012-005\",\r\n \"materialCode\": \"JY646391\",\r\n \"materialName\": \"SW-171不打孔\",\r\n \"profileModel\": \"SH-045\",\r\n \"weight\": 0.2,\r\n \"specification\": \"32*14.0\",\r\n \"thickness\": 1,\r\n \"piecesBundle\": 25,\r\n \"materialCategory\": \"型材系列\",\r\n \"defaultLength\": 6,\r\n \"packagingMethod\": \"6\",\r\n \"source\": \"source2\",\r\n \"unit\": \"支\",\r\n \"orderLength\": 1,\r\n \"orderTotalQuantity\": 1,\r\n \"surfaceMethod\": null,\r\n \"theoreticalWeightPerPiece\": 0.2,\r\n \"theoreticalWeight\": null,\r\n \"packingQuantity\": 0,\r\n \"deliveryDate\": \"2024-10-29\",\r\n \"customerMaterialCode\": null,\r\n \"producedPieces\": 0,\r\n \"producedLength\": 0,\r\n \"priceWithTax\": 0,\r\n \"amountWithTax\": 0,\r\n \"shipmentsedNumber\": 0,\r\n \"returnedNumber\": null,\r\n \"status\": 1,\r\n \"productionLength\": 1,\r\n \"productionPieces\": 1,\r\n \"pieces\": null,\r\n \"productionWeight\": 0.2,\r\n \"undeliveredQuantity\": 1\r\n },\r\n {\r\n \"id\": 1676,\r\n \"documentNumber\": \"BG20241012002\",\r\n \"plannedPieces\": 1,\r\n \"remarks\": \"\",\r\n \"salesDate\": \"2024-10-18\",\r\n \"customerName\": \"测试44\",\r\n \"salespersonName\": \"超级管理员\",\r\n \"price\": null,\r\n \"pricingDate\": 1730304000000,\r\n \"taxRate\": \"0.09\",\r\n \"processingFee\": null,\r\n \"orderNo\": \"00500\",\r\n \"salesOrderCode\": \"CS4420241012-005\",\r\n \"materialCode\": \"JY646390\",\r\n \"materialName\": \"SW-170不打孔\",\r\n \"profileModel\": \"SH-044\",\r\n \"weight\": 0.19,\r\n \"specification\": \"30*12.6\",\r\n \"thickness\": 0.9,\r\n \"piecesBundle\": 20,\r\n \"materialCategory\": \"型材系列\",\r\n \"defaultLength\": 6,\r\n \"packagingMethod\": \"6\",\r\n \"source\": \"source1\",\r\n \"unit\": \"支\",\r\n \"orderLength\": 1,\r\n \"orderTotalQuantity\": 1,\r\n \"surfaceMethod\": null,\r\n \"theoreticalWeightPerPiece\": 0.19,\r\n \"theoreticalWeight\": null,\r\n \"packingQuantity\": 0,\r\n \"deliveryDate\": \"2024-10-29\",\r\n \"customerMaterialCode\": null,\r\n \"producedPieces\": 0,\r\n \"producedLength\": 0,\r\n \"priceWithTax\": 0,\r\n \"amountWithTax\": 0,\r\n \"shipmentsedNumber\": 0,\r\n \"returnedNumber\": null,\r\n \"status\": 1,\r\n \"productionLength\": 1,\r\n \"productionPieces\": 1,\r\n \"pieces\": null,\r\n \"productionWeight\": 0.19,\r\n \"undeliveredQuantity\": 1\r\n }\r\n ],\r\n \"orderInfo\": {\r\n \"scheduleNumber\": \"44\",\r\n \"isAuto\": true,\r\n \"extrusionDate\": \"2024-09-07\",\r\n \"extrusionMachine\": \"sdf\",\r\n \"extrusionTeam\": \"zv\",\r\n \"remarks\": null\r\n }\r\n}",
"headers" : [ {
"name" : "authorization",
- "value" : null,
+ "value" : "5E34C0D7EA601026B93C26119C7E1AD57BDC4F4DD7836B6F883430E388E7D8A0704B7E0E35AAA6410EEFECDD2A2E5988",
"description" : "登录token",
"required" : false,
"dataType" : "String",
@@ -40,20 +40,61 @@
"children" : null
} ],
"paths" : [ ],
- "responseBody" : null,
+ "responseBody" : "{\n \"code\": -1,\n \"data\": null,\n \"message\": \"提交失败\"\n}",
"description" : null,
"requestBodyDefinition" : null,
"responseBodyDefinition" : null
}
================================
-String id = body.id;
-String createBy = body.createBy;
-String extrusionDate = body.extrusionDate;
-String extrusionMachine = body.extrusionMachine;
-String extrusionTeam = body.extrusionTeam;
-String remarks = body.remarks;
-String scheduleNumber = body.scheduleNumber;
+Map orderInfo = body.orderInfo;
+var materialsList = body.materials
-return db.update("""
- update mini_extrusion_schedule set create_by = #{createBy}, extrusion_date = #{extrusionDate}, extrusion_machine = #{extrusionMachine}, extrusion_team = #{extrusionTeam}, remarks = #{remarks}, schedule_number = #{scheduleNumber} where id = #{id}
-""");
\ No newline at end of file
+String userId = StringUtil.objectToString(request.get().getAttribute("openid"));
+// 查询数据库获取对应 userId 的用户名
+String createBy = db.selectOne("""SELECT user_name FROM sys_user WHERE user_id = #{userId}""").userName;
+
+var tx = db.transaction(); //开启事务
+try{
+ int res = db.table("mini_extrusion_schedule").primary("schedule_number")
+ .update({
+ schedule_number: orderInfo.scheduleNumber,
+ extrusion_date: orderInfo.extrusionDate,
+ extrusion_machine: orderInfo.extrusionMachine,
+ extrusion_team: orderInfo.extrusionTeam,
+ remarks: orderInfo.remarks
+ })
+
+ if (res > 0) {
+ println("挤压排产单插入成功")
+
+ db.update("delete from mini_extrusion_schedule_detail where schedule_number = #{orderInfo.scheduleNumber}")
+
+ List list = new ArrayList();
+ List list2 = new ArrayList();
+ materialsList.map(marerial => {
+ list.add({
+ schedule_number: orderInfo.scheduleNumber,
+ sales_order_code: marerial.salesOrderCode,
+ material_code: marerial.materialCode,
+ production_length: marerial.productionLength,
+ production_pieces: marerial.productionPieces,
+ sawing_method: marerial.sawingMethod,
+ create_by: createBy
+ })
+ })
+
+ res = db.table("mini_extrusion_schedule_detail").batchInsert(list)
+
+ if (res > 0) {
+ tx.commit(); // 提交事务
+ exit 0, "执行成功", null;
+ }
+ }
+ tx.rollback();
+ exit -1, "提交失败";
+}catch(e){
+ println(e.getMessage())
+ tx.rollback(); // 回滚事务
+ exit -1, "提交失败";
+}
+
\ No newline at end of file
diff --git a/appengine/src/main/resources/api_file/api/web管理端API/生产管理/挤压排产表/列表.ms b/appengine/src/main/resources/api_file/api/web管理端API/生产管理/挤压排产表/列表.ms
index 8651ff2..83d9e15 100644
--- a/appengine/src/main/resources/api_file/api/web管理端API/生产管理/挤压排产表/列表.ms
+++ b/appengine/src/main/resources/api_file/api/web管理端API/生产管理/挤压排产表/列表.ms
@@ -5,7 +5,7 @@
"groupId" : "f4b3acf704cf4db29258ba70e24f8fc5",
"name" : "列表",
"createTime" : null,
- "updateTime" : 1727705149191,
+ "updateTime" : 1728727705064,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@@ -53,19 +53,23 @@ String extrusionTeam = body.extrusionTeam;
var sql = """
select
- id,
- schedule_number,
- date_format(extrusion_date, '%Y-%m-%d') as extrusion_date,
- extrusion_machine,
- extrusion_team,
- remarks
+ mes.id,
+ mes.schedule_number,
+ date_format(mes.extrusion_date, '%Y-%m-%d') as extrusion_date,
+ mes.extrusion_machine,
+ mpm.machine_name as extrusion_machine_name,
+ mes.extrusion_team,
+ su.user_name as extrusion_team_name,
+ mes.remarks
from
- mini_extrusion_schedule
+ mini_extrusion_schedule mes
+ left join sys_user su on su.user_id = mes.extrusion_team
+ left join mini_production_machines mpm on mpm.machine_code = mes.extrusion_machine
where 1=1
- ?{scheduleNumber!=null && scheduleNumber!="", and schedule_number like concat('%', #{scheduleNumber} ,'%') }
- ?{extrusionDate!=null && extrusionDate!="", and extrusion_date like concat('%', #{extrusionDate} ,'%') }
- ?{extrusionMachine!=null && extrusionMachine!="", and extrusion_machine like concat('%', #{extrusionMachine} ,'%') }
- ?{extrusionTeam!=null && extrusionTeam!="", and extrusion_team like concat('%', #{extrusionTeam} ,'%') }
+ ?{scheduleNumber!=null && scheduleNumber!="", and mes.schedule_number like concat('%', #{scheduleNumber} ,'%') }
+ ?{extrusionDate!=null && extrusionDate!="", and date(mes.extrusion_date) = #{extrusionDate} }
+ ?{extrusionMachine!=null && extrusionMachine!="", and mes.extrusion_machine = #{extrusionMachine} }
+ ?{extrusionTeam!=null && extrusionTeam!="", and mes.extrusion_team = #{extrusionTeam} }
"""
return db.page(sql);
diff --git a/appengine/src/main/resources/api_file/api/web管理端API/生产管理/挤压排产表/新增.ms b/appengine/src/main/resources/api_file/api/web管理端API/生产管理/挤压排产表/新增.ms
index 46aeb10..bfeb59d 100644
--- a/appengine/src/main/resources/api_file/api/web管理端API/生产管理/挤压排产表/新增.ms
+++ b/appengine/src/main/resources/api_file/api/web管理端API/生产管理/挤压排产表/新增.ms
@@ -5,7 +5,7 @@
"groupId" : "f4b3acf704cf4db29258ba70e24f8fc5",
"name" : "新增",
"createTime" : null,
- "updateTime" : 1726367805520,
+ "updateTime" : 1728726723475,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@@ -46,18 +46,26 @@
"responseBodyDefinition" : null
}
================================
+import 'commonServices' as CommonServices
+
Map orderInfo = body.orderInfo;
-Map purchInfo = body.purchInfo;
var materialsList = body.materials
String userId = StringUtil.objectToString(request.get().getAttribute("openid"));
// 查询数据库获取对应 userId 的用户名
String createBy = db.selectOne("""SELECT user_name FROM sys_user WHERE user_id = #{userId}""").userName;
+if (orderInfo.isAuto) {
+ // 自动生成编码
+ orderInfo.scheduleNumber = CommonServices.getCode("ProductionSchedulingNumber", orderInfo)
+}
+
+
var tx = db.transaction(); //开启事务
try{
int res = db.table("mini_extrusion_schedule").insert({
schedule_number: orderInfo.scheduleNumber,
+ code_auto: orderInfo.isAuto,
extrusion_date: orderInfo.extrusionDate,
extrusion_machine: orderInfo.extrusionMachine,
extrusion_team: orderInfo.extrusionTeam,
@@ -68,33 +76,33 @@ try{
if (res > 0) {
println("挤压排产单插入成功")
- res = db.update("""
- update mini_production_schedule
- SET productioned_pieces = CASE
-
- WHEN material_code = #{item.materialCode} and sales_order_code = #{purchInfo.documentNumber} THEN productioned_pieces + #{item.productionPieces}
-
- ELSE productioned_pieces
- END
- WHERE (sales_order_code, material_code) in (
-
- (#{purchInfo.documentNumber}, #{item.materialCode})
-
- )
- """)
+ // res = db.update("""
+ // update mini_production_schedule
+ // SET productioned_pieces = CASE
+ //
+ // WHEN material_code = #{item.materialCode} and sales_order_code = #{purchInfo.documentNumber} THEN productioned_pieces + #{item.productionPieces}
+ //
+ // ELSE productioned_pieces
+ // END
+ // WHERE (sales_order_code, material_code) in (
+ //
+ // (#{purchInfo.documentNumber}, #{item.materialCode})
+ //
+ // )
+ // """)
- if (res <= 0) {
- tx.rollback();
- println("更新计划表失败")
- exit -1, "提交失败";
- }
+ // if (res <= 0) {
+ // tx.rollback();
+ // println("更新计划表失败")
+ // exit -1, "提交失败";
+ // }
List list = new ArrayList();
List list2 = new ArrayList();
materialsList.map(marerial => {
list.add({
schedule_number: orderInfo.scheduleNumber,
- sales_order_code: purchInfo.documentNumber,
+ sales_order_code: marerial.salesOrderCode,
material_code: marerial.materialCode,
production_length: marerial.productionLength,
production_pieces: marerial.productionPieces,
diff --git a/appengine/src/main/resources/api_file/api/web管理端API/生产管理/挤压排产表/详情.ms b/appengine/src/main/resources/api_file/api/web管理端API/生产管理/挤压排产表/详情.ms
new file mode 100644
index 0000000..8a65479
--- /dev/null
+++ b/appengine/src/main/resources/api_file/api/web管理端API/生产管理/挤压排产表/详情.ms
@@ -0,0 +1,68 @@
+{
+ "properties" : { },
+ "id" : "72e2009a2fe2476d94270cb8307a4185",
+ "script" : null,
+ "groupId" : "f4b3acf704cf4db29258ba70e24f8fc5",
+ "name" : "详情",
+ "createTime" : null,
+ "updateTime" : 1728728158049,
+ "lock" : null,
+ "createBy" : null,
+ "updateBy" : null,
+ "path" : "/detail",
+ "method" : "POST",
+ "parameters" : [ ],
+ "options" : [ ],
+ "requestBody" : "",
+ "headers" : [ ],
+ "paths" : [ ],
+ "responseBody" : null,
+ "description" : null,
+ "requestBodyDefinition" : null,
+ "responseBodyDefinition" : null
+}
+================================
+import '@/common/sql' as sql
+
+String salesOrder = sql("salesOrder")
+String scheduleNumber = body.scheduleNumber;
+
+return {
+ orderInfo: db.selectOne("""
+ select
+ schedule_number,
+ date_format(extrusion_date, '%Y-%m-%d') as extrusion_date,
+ extrusion_machine,
+ extrusion_team,
+ remarks
+ from mini_extrusion_schedule
+ where 1=1
+ and schedule_number=#{scheduleNumber}
+ """),
+ materials: db.select("""
+ select
+ mesd.schedule_number,
+ mesd.production_length,
+ mesd.production_pieces,
+ mesd.sawing_method,
+ date_format(mso.sales_date, '%Y-%m-%d') as sales_date,
+ mci.customer_name,
+ su.user_name as salesperson_name,
+ mso.price,
+ mso.pricing_date,
+ mso.tax_rate,
+ mso.processing_fee,
+ ${salesOrder}
+ from
+ mini_extrusion_schedule_detail mesd
+ left join mini_sales_orders mso on mso.document_number = mesd.sales_order_code
+ left join sys_user su on su.user_id = mso.salesperson
+ left join mini_customer_info mci on mci.customer_code = mso.customer_id
+ left join mini_sales_order_materials msm
+ on mesd.sales_order_code = msm.sales_order_code and mesd.material_code = msm.material_code
+ where 1=1 and mesd.schedule_number=#{scheduleNumber}
+
+ """),
+
+
+}
\ No newline at end of file
diff --git a/appengine/src/main/resources/api_file/api/web管理端API/生产管理/计划挤压排产管理/列表.ms b/appengine/src/main/resources/api_file/api/web管理端API/生产管理/计划挤压排产管理/列表.ms
index 0e4e387..9a37405 100644
--- a/appengine/src/main/resources/api_file/api/web管理端API/生产管理/计划挤压排产管理/列表.ms
+++ b/appengine/src/main/resources/api_file/api/web管理端API/生产管理/计划挤压排产管理/列表.ms
@@ -5,7 +5,7 @@
"groupId" : "06d35cc5db5f4e6681262a1648c871c3",
"name" : "列表",
"createTime" : null,
- "updateTime" : 1727082770981,
+ "updateTime" : 1728726289833,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@@ -40,7 +40,7 @@
"children" : null
} ],
"paths" : [ ],
- "responseBody" : "{\n \"code\": 0,\n \"data\": {\n \"count\": 2,\n \"list\": [\n {\n \"salesOrderCode\": \"YS004\",\n \"materialCode\": \"JY646390\",\n \"plannedPieces\": 1,\n \"remarks\": \"safasd\",\n \"materialName\": \"SW-170不打孔\",\n \"profileModel\": \"SH-044\",\n \"weight\": 0.19,\n \"specification\": \"30*12.6\",\n \"thickness\": 0.9,\n \"piecesBundle\": 20,\n \"materialCategory\": \"型材系列\",\n \"defaultLength\": 6,\n \"packagingMethod\": \"6\",\n \"source\": \"source1\",\n \"unit\": \"支\",\n \"orderLength\": 1,\n \"orderTotalQuantity\": 1,\n \"surfaceMethod\": null,\n \"theoreticalWeightPerPiece\": 0.19,\n \"theoreticalWeight\": 0.19,\n \"packingQuantity\": 0,\n \"deliveryDate\": 1726243200000,\n \"customerMaterialCode\": null,\n \"producedPieces\": 0,\n \"producedLength\": 0,\n \"priceWithTax\": 10010,\n \"amountWithTax\": 0,\n \"shipmentsedNumber\": 0,\n \"returnedNumber\": null,\n \"status\": 1\n },\n {\n \"salesOrderCode\": \"YS004\",\n \"materialCode\": \"JY646391\",\n \"plannedPieces\": 1,\n \"remarks\": \"\",\n \"materialName\": \"SW-171不打孔\",\n \"profileModel\": \"SH-045\",\n \"weight\": 0.2,\n \"specification\": \"32*14.0\",\n \"thickness\": 1,\n \"piecesBundle\": 25,\n \"materialCategory\": \"型材系列\",\n \"defaultLength\": 6,\n \"packagingMethod\": \"6\",\n \"source\": \"source2\",\n \"unit\": \"支\",\n \"orderLength\": 1,\n \"orderTotalQuantity\": 1,\n \"surfaceMethod\": null,\n \"theoreticalWeightPerPiece\": 0.2,\n \"theoreticalWeight\": 0.2,\n \"packingQuantity\": 0,\n \"deliveryDate\": 1726243200000,\n \"customerMaterialCode\": null,\n \"producedPieces\": 0,\n \"producedLength\": 0,\n \"priceWithTax\": 10010,\n \"amountWithTax\": 0,\n \"shipmentsedNumber\": 0,\n \"returnedNumber\": null,\n \"status\": 1\n }\n ]\n },\n \"message\": \"success\"\n}",
+ "responseBody" : "{\n \"code\": -2,\n \"message\": \"token无效\",\n \"data\": null,\n \"timestamp\": 1728719907434,\n \"executeTime\": null\n}",
"description" : null,
"requestBodyDefinition" : {
"name" : "root",
@@ -156,37 +156,37 @@
================================
import '@/common/sql' as sql
-String extrusionScheduleId = body["extrusionScheduleId"];
-String orderNumber = body["orderNumber"];
-String productCode = body["productCode"];
-String customerMaterialNumber = body["customerMaterialNumber"];
-String deliveryDate = body["deliveryDate"];
-// var sql = """
-// select color, create_by, date_format(create_time, '%Y-%m-%d %H:%i:%S') as create_time, delivery_date, id, material_name, order_number, order_total, planned_pieces, product_code, profile_model, profile_name, remarks, sales_order_number, specification, surface_treatment, theoretical_bundle_weight, theoretical_weight, weight
-// from mini_production_schedule
-// where 1 = 1
-// ?{extrusionScheduleId != null and extrusionScheduleId != '', and extrusion_schedule_id like concat('%', #{extrusionScheduleId}, '%')}
-// ?{orderNumber != null and orderNumber != '', and order_number like concat('%', #{orderNumber}, '%')}
-// ?{productCode != null and productCode != '', and product_code like concat('%', #{productCode}, '%')}
-// ?{customerMaterialNumber != null and customerMaterialNumber != '', and customer_material_number like concat('%', #{customerMaterialNumber}, '%')}
-// ?{deliveryDate != null and deliveryDate != '', and date_format(delivery_date, '%Y-%m-%d') = #{deliveryDate}}
-// """
+String documentNumber = body["documentNumber"];
+String salesOrderCode = body["salesOrderCode"];
+String materialName = body["materialName"];
String salesOrdeSelect = sql("salesOrder")
String sql = """
select
mps.id,
+ mps.document_number,
mps.planned_pieces,
mps.remarks,
+ date_format(mso.sales_date, '%Y-%m-%d') as sales_date,
+ mci.customer_name,
+ su.user_name as salesperson_name,
+ mso.price,
+ mso.pricing_date,
+ mso.tax_rate,
+ mso.processing_fee,
${salesOrdeSelect}
from
mini_production_schedule mps
+ left join mini_sales_orders mso on mso.document_number = mps.sales_order_code
+ left join sys_user su on su.user_id = mso.salesperson
+ left join mini_customer_info mci on mci.customer_code = mso.customer_id
left join mini_sales_order_materials msm
on mps.sales_order_code = msm.sales_order_code and mps.material_code = msm.material_code
where 1=1
?{salesOrderCode != null and salesOrderCode != "", and mps.sales_order_code = #{salesOrderCode}}
-
+ ?{documentNumber != null and documentNumber != "", and mps.document_number = #{documentNumber}}
+ ?{materialName != null and materialName != "", and msm.material_name like concat('%', #{materialName}, '%')}
""";
return db.page(sql);
diff --git a/appengine/src/main/resources/api_file/api/web管理端API/生产管理/计划挤压排产管理/新增.ms b/appengine/src/main/resources/api_file/api/web管理端API/生产管理/计划挤压排产管理/新增.ms
index 3b48cdf..8db7b77 100644
--- a/appengine/src/main/resources/api_file/api/web管理端API/生产管理/计划挤压排产管理/新增.ms
+++ b/appengine/src/main/resources/api_file/api/web管理端API/生产管理/计划挤压排产管理/新增.ms
@@ -5,7 +5,7 @@
"groupId" : "06d35cc5db5f4e6681262a1648c871c3",
"name" : "新增",
"createTime" : null,
- "updateTime" : 1726361471903,
+ "updateTime" : 1728724750705,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@@ -46,8 +46,11 @@
"responseBodyDefinition" : null
}
================================
+import 'commonServices' as CommonServices
+
List selection = body.selection;
Map orderInfo = body.orderInfo;
+Map form = body.form;
if (Objects.isNull(selection) || selection.size() <= 0) {
exit -1, "数据为空"
}
@@ -56,10 +59,19 @@ String userId = StringUtil.objectToString(request.get().getAttribute("openid"));
// 查询数据库获取对应 userId 的用户名
String createBy = db.selectOne("""SELECT user_name FROM sys_user WHERE user_id = #{userId}""").userName;
+String documentNumber = form.documentNumber
+
+if (form.isAuto) {
+ // 自动生成编码
+ documentNumber = CommonServices.getCode("ProductionOrderNumber", orderInfo)
+}
+
+
var tx = db.transaction(); //开启事务
try{
var res = db.insert("""
insert into mini_production_schedule(
+ document_number,
sales_order_code,
material_code,
planned_pieces,
@@ -67,7 +79,7 @@ try{
create_by
) values
- (#{orderInfo.documentNumber}, #{item.materialCode},#{item.plannedPieces},#{item.remarks},#{createBy})
+ (#{documentNumber}, #{orderInfo.documentNumber}, #{item.materialCode},#{item.plannedPieces},#{item.remarks},#{createBy})
""")
if (res > 0) {
diff --git a/appengine/src/main/resources/api_file/api/web管理端API/生产管理/计划挤压排产管理/详情.ms b/appengine/src/main/resources/api_file/api/web管理端API/生产管理/计划挤压排产管理/详情.ms
index 42aeea1..f23fe4b 100644
--- a/appengine/src/main/resources/api_file/api/web管理端API/生产管理/计划挤压排产管理/详情.ms
+++ b/appengine/src/main/resources/api_file/api/web管理端API/生产管理/计划挤压排产管理/详情.ms
@@ -5,7 +5,7 @@
"groupId" : "06d35cc5db5f4e6681262a1648c871c3",
"name" : "详情",
"createTime" : null,
- "updateTime" : 1726365901110,
+ "updateTime" : 1728721582011,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@@ -24,7 +24,7 @@
================================
import '@/common/sql' as sql
-String documentNumber = body["documentNumber"];
+String salesOrderCode = body["salesOrderCode"];
String salesOrdeSelect = sql("salesOrder")
String sql = """
select
@@ -36,7 +36,7 @@ String sql = """
mini_production_schedule mps
left join mini_sales_order_materials msm
on mps.sales_order_code = msm.sales_order_code and mps.material_code = msm.material_code
- where 1=1 and mps.sales_order_code = #{documentNumber}
+ where 1=1 and mps.sales_order_code = #{salesOrderCode}
""";
diff --git a/appengine/src/main/resources/api_file/api/web管理端API/采购管理/采购订单管理/新增.ms b/appengine/src/main/resources/api_file/api/web管理端API/采购管理/采购订单管理/新增.ms
index da22737..ae17e2b 100644
--- a/appengine/src/main/resources/api_file/api/web管理端API/采购管理/采购订单管理/新增.ms
+++ b/appengine/src/main/resources/api_file/api/web管理端API/采购管理/采购订单管理/新增.ms
@@ -5,7 +5,7 @@
"groupId" : "a2b7765d540449b7bf93e070c1911ce9",
"name" : "新增",
"createTime" : null,
- "updateTime" : 1727705407686,
+ "updateTime" : 1728703255361,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@@ -586,6 +586,8 @@
}
}
================================
+import 'commonServices' as CommonServices
+
Map orderInfo = body.orderInfo;
var materialsList = body.materials
@@ -593,10 +595,16 @@ String userId = StringUtil.objectToString(request.get().getAttribute("openid"));
// 查询数据库获取对应 userId 的用户名
String createBy = db.selectOne("""SELECT user_name FROM sys_user WHERE user_id = #{userId}""").userName;
+if (orderInfo.isAuto) {
+ // 自动生成编码
+ orderInfo.documentNumber = CommonServices.getCode("PurchaseNumber", orderInfo)
+}
+
var tx = db.transaction(); //开启事务
try{
int res = db.table("mini_purchase_orders").insert({
document_number: orderInfo.documentNumber,
+ code_auto: orderInfo.isAuto,
supplier: orderInfo.supplier,
purchase_date: orderInfo.purchaseDate,
purchaser: orderInfo.purchaser,
diff --git a/appengine/src/main/resources/api_file/api/web管理端API/销售管理/客户资料管理/列表.ms b/appengine/src/main/resources/api_file/api/web管理端API/销售管理/客户资料管理/列表.ms
index ce0c009..99f2d72 100644
--- a/appengine/src/main/resources/api_file/api/web管理端API/销售管理/客户资料管理/列表.ms
+++ b/appengine/src/main/resources/api_file/api/web管理端API/销售管理/客户资料管理/列表.ms
@@ -5,7 +5,7 @@
"groupId" : "5740e8dbe1f641e69fa41f60087dea98",
"name" : "列表",
"createTime" : null,
- "updateTime" : 1726305048852,
+ "updateTime" : 1728631803765,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@@ -58,6 +58,7 @@ return db.page("""
contact_phone,
create_by,
date_format(create_time,'%Y-%m-%d %H:%i:%S') as create_time,
+ customer_code,
customer_name,
id,
is_tax_included,
diff --git a/appengine/src/main/resources/api_file/api/web管理端API/销售管理/客户资料管理/新增.ms b/appengine/src/main/resources/api_file/api/web管理端API/销售管理/客户资料管理/新增.ms
index ba4a26d..54d66a4 100644
--- a/appengine/src/main/resources/api_file/api/web管理端API/销售管理/客户资料管理/新增.ms
+++ b/appengine/src/main/resources/api_file/api/web管理端API/销售管理/客户资料管理/新增.ms
@@ -5,7 +5,7 @@
"groupId" : "5740e8dbe1f641e69fa41f60087dea98",
"name" : "新增",
"createTime" : null,
- "updateTime" : 1724482007481,
+ "updateTime" : 1728652880039,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@@ -46,6 +46,11 @@
"responseBodyDefinition" : null
}
================================
+import 'commonServices' as CommonServices
+
+Boolean isAuto = body.isAuto; // 是否自动生成编码 1-自动生成 0-非自动生成
+
+String customerCode = body.customerCode;
String address = body.address;
String contactPerson = body.contactPerson;
String contactPhone = body.contactPhone;
@@ -60,6 +65,33 @@ String userId = StringUtil.objectToString(request.get().getAttribute("openid"));
// 查询数据库获取对应 userId 的用户名
String createBy = db.selectOne("""SELECT user_name FROM sys_user WHERE user_id = #{userId}""").userName;
-return db.insert("""
-insert into mini_customer_info(address, contact_person, contact_phone, create_by, customer_name, is_tax_included, remarks, settlement_currency, status, tax) values(#{address}, #{contactPerson}, #{contactPhone}, #{createBy}, #{customerName}, #{isTaxIncluded}, #{remarks}, #{settlementCurrency}, #{status}, #{tax})
-""");
\ No newline at end of file
+Map map = db.selectOne("select * from mini_customer_info where customer_code=#{customerCode}")
+if (map != null) {
+ exit -1, "客户资料已存在!"
+}
+
+
+if (isAuto) {
+ // 自动生成编码
+ customerCode = CommonServices.getCode("CustomerCode", null)
+}
+
+return db.table("mini_customer_info").insert({
+ code_auto: isAuto,
+ customer_code: customerCode,
+ address: address,
+ contact_person: contactPerson,
+ contact_phone: contactPhone,
+ create_by: createBy,
+ customer_name: customerName,
+ is_tax_included: isTaxIncluded,
+ remarks: remarks,
+ settlement_currency: settlementCurrency,
+ status: status,
+ tax: tax
+})
+
+// return db.insert("""
+// insert into mini_customer_info(address, contact_person, contact_phone, create_by, customer_name, is_tax_included, remarks, settlement_currency, status, tax)
+// values(#{address}, #{contactPerson}, #{contactPhone}, #{createBy}, #{customerName}, #{isTaxIncluded}, #{remarks}, #{settlementCurrency}, #{status}, #{tax})
+// """);
\ No newline at end of file
diff --git a/appengine/src/main/resources/api_file/api/web管理端API/销售管理/销售出货管理/详情.ms b/appengine/src/main/resources/api_file/api/web管理端API/销售管理/销售出货管理/详情.ms
index c1ffbdd..e2ccf5f 100644
--- a/appengine/src/main/resources/api_file/api/web管理端API/销售管理/销售出货管理/详情.ms
+++ b/appengine/src/main/resources/api_file/api/web管理端API/销售管理/销售出货管理/详情.ms
@@ -5,7 +5,7 @@
"groupId" : "a170047f79ab4cb1b892edc5cccd823e",
"name" : "详情",
"createTime" : null,
- "updateTime" : 1727081842954,
+ "updateTime" : 1728728439695,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@@ -66,7 +66,7 @@ return {
msom.packing_quantity,
msom.packaging_method,
msom.produced_pieces,
- ${salesOrderCode} as sales_order_code
+ '${salesOrderCode}' as sales_order_code
from mini_sales_shipment_materials mssm
left join mini_sales_order_materials msom on msom.material_code = mssm.material_code
where mssm.sales_shipment_code = #{documentNumber} and msom.sales_order_code=#{salesOrderCode}
diff --git a/appengine/src/main/resources/api_file/api/web管理端API/销售管理/销售订单管理/修改.ms b/appengine/src/main/resources/api_file/api/web管理端API/销售管理/销售订单管理/修改.ms
index f222184..f44f6bd 100644
--- a/appengine/src/main/resources/api_file/api/web管理端API/销售管理/销售订单管理/修改.ms
+++ b/appengine/src/main/resources/api_file/api/web管理端API/销售管理/销售订单管理/修改.ms
@@ -5,7 +5,7 @@
"groupId" : "e631b317606f4246ac82585a7c1f1c5b",
"name" : "修改",
"createTime" : null,
- "updateTime" : 1727704801418,
+ "updateTime" : 1728723349382,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@@ -25,10 +25,10 @@
"expression" : null,
"children" : null
} ],
- "requestBody" : "",
+ "requestBody" : "{\r\n \"materials\": [\r\n {\r\n \"id\": 62937,\r\n \"salesOrderCode\": \"CS4420241012-005\",\r\n \"materialCode\": \"JY646390\",\r\n \"materialName\": \"SW-170不打孔\",\r\n \"profileModel\": \"SH-044\",\r\n \"weight\": 0.19,\r\n \"specification\": \"30*12.6\",\r\n \"thickness\": 0.9,\r\n \"piecesBundle\": 20,\r\n \"materialCategory\": \"型材系列\",\r\n \"defaultLength\": 6,\r\n \"packagingMethod\": \"6\",\r\n \"source\": \"source1\",\r\n \"unit\": \"支\",\r\n \"orderLength\": 1,\r\n \"orderTotalQuantity\": 1,\r\n \"surfaceMethod\": null,\r\n \"theoreticalWeightPerPiece\": 0.19,\r\n \"theoreticalWeight\": 0.19,\r\n \"packingQuantity\": 0.05,\r\n \"deliveryDate\": \"2024-10-29\",\r\n \"customerMaterialCode\": null,\r\n \"producedPieces\": 0,\r\n \"producedLength\": 0,\r\n \"priceWithTax\": 0,\r\n \"amountWithTax\": 0,\r\n \"remark\": null,\r\n \"shipmentsedNumber\": 0,\r\n \"returnedNumber\": null,\r\n \"createBy\": \"超级管理员\",\r\n \"createTime\": 1728722943000,\r\n \"updateTime\": 1728722943000,\r\n \"unitPrice\": 0,\r\n \"orderNo\": \"11111\",\r\n \"status\": 0,\r\n \"noNumber\": 1,\r\n \"taxRate\": 0.09,\r\n \"isAuto\": true\r\n },\r\n {\r\n \"id\": 62938,\r\n \"salesOrderCode\": \"CS4420241012-005\",\r\n \"materialCode\": \"JY646391\",\r\n \"materialName\": \"SW-171不打孔\",\r\n \"profileModel\": \"SH-045\",\r\n \"weight\": 0.2,\r\n \"specification\": \"32*14.0\",\r\n \"thickness\": 1,\r\n \"piecesBundle\": 25,\r\n \"materialCategory\": \"型材系列\",\r\n \"defaultLength\": 6,\r\n \"packagingMethod\": \"6\",\r\n \"source\": \"source2\",\r\n \"unit\": \"支\",\r\n \"orderLength\": 1,\r\n \"orderTotalQuantity\": 1,\r\n \"surfaceMethod\": null,\r\n \"theoreticalWeightPerPiece\": 0.2,\r\n \"theoreticalWeight\": 0.2,\r\n \"packingQuantity\": 0.04,\r\n \"deliveryDate\": \"2024-10-29\",\r\n \"customerMaterialCode\": null,\r\n \"producedPieces\": 0,\r\n \"producedLength\": 0,\r\n \"priceWithTax\": 0,\r\n \"amountWithTax\": 0,\r\n \"remark\": null,\r\n \"shipmentsedNumber\": 0,\r\n \"returnedNumber\": null,\r\n \"createBy\": \"超级管理员\",\r\n \"createTime\": 1728722943000,\r\n \"updateTime\": 1728722943000,\r\n \"unitPrice\": 0,\r\n \"orderNo\": null,\r\n \"status\": 0,\r\n \"noNumber\": 1,\r\n \"taxRate\": 0.09,\r\n \"isAuto\": true\r\n }\r\n ],\r\n \"orderInfo\": {\r\n \"documentNumber\": \"CS4420241012-005\",\r\n \"isAuto\": true,\r\n \"customerId\": \"C00027\",\r\n \"salesDate\": \"2024-10-18\",\r\n \"salesperson\": \"1\",\r\n \"price\": null,\r\n \"pricingDate\": \"2024-10-31\",\r\n \"deliveryDate\": \"2024-10-29\",\r\n \"taxRate\": 0.09,\r\n \"processingFee\": null,\r\n \"remarks\": null,\r\n \"customerName\": \"测试44\",\r\n \"salespersonName\": \"超级管理员\"\r\n }\r\n}",
"headers" : [ {
"name" : "authorization",
- "value" : null,
+ "value" : "5E34C0D7EA601026B93C26119C7E1AD57BDC4F4DD7836B6F883430E388E7D8A0704B7E0E35AAA6410EEFECDD2A2E5988",
"description" : "登录token",
"required" : false,
"dataType" : "String",
@@ -40,12 +40,14 @@
"children" : null
} ],
"paths" : [ ],
- "responseBody" : null,
+ "responseBody" : "{\n \"code\": -1,\n \"data\": null,\n \"message\": \"提交失败\"\n}",
"description" : null,
"requestBodyDefinition" : null,
"responseBodyDefinition" : null
}
================================
+import 'commonServices' as CommonServices
+
Map orderInfo = body.orderInfo;
List materialsList = body.materials
@@ -58,7 +60,6 @@ try{
int res = db.table("mini_sales_orders").where().eq('document_number',orderInfo.documentNumber).update({
document_number: orderInfo.documentNumber,
customer_id: orderInfo.customerId,
- customer_name: orderInfo.customerName,
sales_date: orderInfo.salesDate,
salesperson: orderInfo.salesperson,
price: orderInfo.price,
@@ -75,7 +76,12 @@ try{
db.update("delete from mini_sales_order_materials where sales_order_code=#{orderInfo.documentNumber}")
List list = new ArrayList();
- materialsList.map(marerial => {
+ materialsList.map((marerial, i) => {
+ if (Objects.nonNull(marerial.isAuto) && marerial.isAuto == true) {
+ orderInfo.put("index",i)
+ marerial.orderNo = CommonServices.getCode("OrderNumber", orderInfo)
+ }
+
list.add({
sales_order_code: orderInfo.documentNumber,
order_no: marerial.orderNo,
diff --git a/appengine/src/main/resources/api_file/api/web管理端API/销售管理/销售订单管理/列表.ms b/appengine/src/main/resources/api_file/api/web管理端API/销售管理/销售订单管理/列表.ms
index 82f792e..46f6a40 100644
--- a/appengine/src/main/resources/api_file/api/web管理端API/销售管理/销售订单管理/列表.ms
+++ b/appengine/src/main/resources/api_file/api/web管理端API/销售管理/销售订单管理/列表.ms
@@ -5,7 +5,7 @@
"groupId" : "e631b317606f4246ac82585a7c1f1c5b",
"name" : "列表",
"createTime" : null,
- "updateTime" : 1726316163854,
+ "updateTime" : 1728721690603,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@@ -72,7 +72,7 @@ var sql = """
date_format(mso.create_time, '%Y-%m-%d %H:%i:%S') as create_time
from mini_sales_orders mso
left join sys_user su on su.user_id = mso.salesperson
- left join mini_customer_info mci on mci.id = mso.customer_id
+ left join mini_customer_info mci on mci.customer_code = mso.customer_id
where 1 = 1
?{documentNumber != null and documentNumber != '', and mso.document_number like concat('%', #{documentNumber}, '%')}
?{salesperson != null and salesperson != '', and mso.salesperson like concat('%', #{salesperson}, '%')}
diff --git a/appengine/src/main/resources/api_file/api/web管理端API/销售管理/销售订单管理/新增.ms b/appengine/src/main/resources/api_file/api/web管理端API/销售管理/销售订单管理/新增.ms
index 2b3df01..3229905 100644
--- a/appengine/src/main/resources/api_file/api/web管理端API/销售管理/销售订单管理/新增.ms
+++ b/appengine/src/main/resources/api_file/api/web管理端API/销售管理/销售订单管理/新增.ms
@@ -5,7 +5,7 @@
"groupId" : "e631b317606f4246ac82585a7c1f1c5b",
"name" : "新增",
"createTime" : null,
- "updateTime" : 1727704791936,
+ "updateTime" : 1728723116746,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@@ -25,10 +25,10 @@
"expression" : null,
"children" : null
} ],
- "requestBody" : "",
+ "requestBody" : "{\r\n \"materials\": [\r\n {\r\n \"id\": 1,\r\n \"storehouseId\": null,\r\n \"materialCode\": \"JY646390\",\r\n \"profileModel\": \"SH-044\",\r\n \"materialName\": \"SW-170不打孔\",\r\n \"specification\": \"30*12.6\",\r\n \"thickness\": 0.9,\r\n \"weight\": 0.19,\r\n \"piecesBundle\": 20,\r\n \"materialCategory\": \"型材系列\",\r\n \"materialCategoryName\": null,\r\n \"defaultLength\": 6,\r\n \"packagingMethod\": \"6\",\r\n \"source\": \"source1\",\r\n \"status\": 1,\r\n \"safetyStock\": 1,\r\n \"inventoryUnit\": \"支\",\r\n \"unit\": \"支\",\r\n \"remarks\": \"1\",\r\n \"createBy\": \"超级管理员\",\r\n \"createTime\": \"2024-08-27 06:18:53\",\r\n \"orderLength\": 1,\r\n \"orderTotalQuantity\": 1,\r\n \"pieces\": 0,\r\n \"theoreticalWeight\": 0.19,\r\n \"unitPrice\": 0.12,\r\n \"shipmentsedNumber\": 0,\r\n \"noNumber\": 1,\r\n \"producedPieces\": 0,\r\n \"producedLength\": 0,\r\n \"priceWithTax\": 0.13,\r\n \"amountWithTax\": 0,\r\n \"theoreticalWeightPerPiece\": 0.19,\r\n \"packingQuantity\": 0.05,\r\n \"taxRate\": 0.09,\r\n \"deliveryDate\": \"2024-10-17\"\r\n },\r\n {\r\n \"id\": 2,\r\n \"storehouseId\": null,\r\n \"materialCode\": \"JY646391\",\r\n \"profileModel\": \"SH-045\",\r\n \"materialName\": \"SW-171不打孔\",\r\n \"specification\": \"32*14.0\",\r\n \"thickness\": 1,\r\n \"weight\": 0.2,\r\n \"piecesBundle\": 25,\r\n \"materialCategory\": \"型材系列\",\r\n \"materialCategoryName\": null,\r\n \"defaultLength\": 6,\r\n \"packagingMethod\": \"6\",\r\n \"source\": \"source2\",\r\n \"status\": 1,\r\n \"safetyStock\": 1,\r\n \"inventoryUnit\": \"支\",\r\n \"unit\": \"支\",\r\n \"remarks\": \"2\",\r\n \"createBy\": \"超级管理员\",\r\n \"createTime\": \"2024-08-27 06:18:53\",\r\n \"orderLength\": 1,\r\n \"orderTotalQuantity\": 1,\r\n \"pieces\": 0,\r\n \"theoreticalWeight\": 0.2,\r\n \"unitPrice\": 0.12,\r\n \"shipmentsedNumber\": 0,\r\n \"noNumber\": 1,\r\n \"producedPieces\": 0,\r\n \"producedLength\": 0,\r\n \"priceWithTax\": 0.13,\r\n \"amountWithTax\": 0,\r\n \"theoreticalWeightPerPiece\": 0.2,\r\n \"packingQuantity\": 0.04,\r\n \"taxRate\": 0.09,\r\n \"deliveryDate\": \"2024-10-17\"\r\n }\r\n ],\r\n \"orderInfo\": {\r\n \"documentNumber\": \"\",\r\n \"isAuto\": true,\r\n \"customerId\": \"C00027\",\r\n \"salesDate\": \"2024-10-09\",\r\n \"salesperson\": \"1\",\r\n \"price\": \"123\",\r\n \"pricingDate\": \"2024-10-17\",\r\n \"deliveryDate\": \"2024-10-17\",\r\n \"taxRate\": 0.09,\r\n \"processingFee\": \"12312\",\r\n \"remarks\": \"\"\r\n }\r\n}",
"headers" : [ {
"name" : "authorization",
- "value" : null,
+ "value" : "5E34C0D7EA601026B93C26119C7E1AD57BDC4F4DD7836B6F883430E388E7D8A0704B7E0E35AAA6410EEFECDD2A2E5988",
"description" : "登录token",
"required" : false,
"dataType" : "String",
@@ -40,25 +40,32 @@
"children" : null
} ],
"paths" : [ ],
- "responseBody" : null,
+ "responseBody" : "{\n \"code\": 0,\n \"data\": null,\n \"message\": \"执行成功\"\n}",
"description" : null,
"requestBodyDefinition" : null,
"responseBodyDefinition" : null
}
================================
+import 'commonServices' as CommonServices
+
Map orderInfo = body.orderInfo;
-var materialsList = body.materials
+var materialsList = body.materials;
String userId = StringUtil.objectToString(request.get().getAttribute("openid"));
// 查询数据库获取对应 userId 的用户名
String createBy = db.selectOne("""SELECT user_name FROM sys_user WHERE user_id = #{userId}""").userName;
+if (orderInfo.isAuto) {
+ // 自动生成编码
+ orderInfo.documentNumber = CommonServices.getCode("SalesOrderNumber", orderInfo)
+}
+
var tx = db.transaction(); //开启事务
try{
int res = db.table("mini_sales_orders").insert({
document_number: orderInfo.documentNumber,
+ code_auto: orderInfo.isAuto,
customer_id: orderInfo.customerId,
- customer_name: orderInfo.customerName,
sales_date: orderInfo.salesDate,
salesperson: orderInfo.salesperson,
price: orderInfo.price,
@@ -74,7 +81,11 @@ try{
println("销售订单插入成功")
List list = new ArrayList();
- materialsList.map(marerial => {
+ materialsList.map((marerial, i) => {
+ if (Objects.nonNull(marerial.isAuto) && marerial.isAuto == true) {
+ orderInfo.put("index",i)
+ marerial.orderNo = CommonServices.getCode("OrderNumber", orderInfo)
+ }
list.add({
sales_order_code: orderInfo.documentNumber,
order_no: marerial.orderNo,
diff --git a/appengine/src/main/resources/api_file/api/小程序端API/测试/测试.ms b/appengine/src/main/resources/api_file/api/小程序端API/测试/测试.ms
index ce6b9fd..bf79060 100644
--- a/appengine/src/main/resources/api_file/api/小程序端API/测试/测试.ms
+++ b/appengine/src/main/resources/api_file/api/小程序端API/测试/测试.ms
@@ -5,7 +5,7 @@
"groupId" : "447d969bf99243f188b84289aff1ba91",
"name" : "测试",
"createTime" : null,
- "updateTime" : 1696760200396,
+ "updateTime" : 1728722688440,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@@ -70,5 +70,14 @@
}
}
================================
-return ""
+
+List aa = new ArrayList();
+
+['a','b','c'].map((item, i) => {
+ aa.add({
+ [item]: i
+ })
+})
+
+return aa
diff --git a/appengine/src/main/resources/api_file/function/公共/公共sql.ms b/appengine/src/main/resources/api_file/function/公共/公共sql.ms
index 0919df7..248c5be 100644
--- a/appengine/src/main/resources/api_file/function/公共/公共sql.ms
+++ b/appengine/src/main/resources/api_file/function/公共/公共sql.ms
@@ -5,7 +5,7 @@
"groupId" : "c3fc8c12916e40319e19fc434a708a83",
"name" : "公共sql",
"createTime" : null,
- "updateTime" : 1726382537168,
+ "updateTime" : 1728704818002,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@@ -87,6 +87,41 @@ var sql = {
mwm.pieces,
mwm.supplier,
mwm.warehouse
+ """,
+ "warehouseProductMaterial": """
+ mwp.sales_order_code,
+ mwp.material_code,
+ mwp.material_name,
+ mwp.profile_model,
+ mwp.weight,
+ mwp.specification,
+ mwp.thickness,
+ mwp.pieces_bundle,
+ mwp.material_category,
+ mwp.default_length,
+ mwp.packaging_method,
+ mwp.source,
+ mwp.unit,
+ mwp.order_length,
+ mwp.order_total_quantity,
+ mwp.surface_method,
+ mwp.theoretical_weight_per_piece,
+ mwp.theoretical_weight,
+ mwp.packing_quantity,
+ mwp.delivery_date,
+ mwp.customer_material_code,
+ mwp.produced_pieces,
+ mwp.produced_length,
+ mwp.price_with_tax,
+ mwp.amount_with_tax,
+ mwp.remark,
+ mwp.shipmentsed_number,
+ mwp.returned_number,
+ mwp.unit_price,
+ mwp.order_no,
+ mwp.existing_inventory,
+ mwp.customer_id,
+ mwp.warehouse
"""
}
return sql[type]
diff --git a/appengine/src/main/resources/application-local.yml b/appengine/src/main/resources/application-local.yml
index 574991c..f03fe1f 100644
--- a/appengine/src/main/resources/application-local.yml
+++ b/appengine/src/main/resources/application-local.yml
@@ -2,8 +2,10 @@ var:
env: local # dev-开发 pro-生产
port: 9080
mysql:
- ip: 127.0.0.1
- port: 3306
+# ip: 127.0.0.1
+ ip: 106.227.69.97
+# port: 3306
+ port: 3307
database: 883web
user: 883web
password: LFw24KPkdFdtdw5W