20241116更新

main
lcode 1 week ago
parent 7a20f97b92
commit dcf12fe671

@ -1,26 +1,18 @@
package com.currency.appengine.config; package com.currency.appengine.config;
import com.currency.appengine.filter.RepeatedlyReadFilter;
import com.currency.appengine.handler.CustomMethodArgumentResolver;
import com.currency.appengine.handler.GlobalInterceptor; import com.currency.appengine.handler.GlobalInterceptor;
import com.currency.appengine.handler.SignInterceptor; import com.currency.appengine.handler.CustomMethodArgumentResolver;
import com.currency.appengine.handler.magic.DevInterceptor; import com.currency.appengine.handler.magic.DevInterceptor;
import java.util.List;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.*;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import java.util.List;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration @Configuration
@EnableWebMvc @EnableWebMvc
public class WebMvcConfig implements WebMvcConfigurer { public class WebMvcConfig implements WebMvcConfigurer {
/** /**
* Interceptor verification token * Interceptor verification token
* *
@ -36,15 +28,9 @@ public class WebMvcConfig implements WebMvcConfigurer {
return new DevInterceptor(); return new DevInterceptor();
} }
@Bean
public SignInterceptor signInterceptor() {
return new SignInterceptor();
}
@Override @Override
public void addInterceptors(InterceptorRegistry registry) { public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(GlobalInterceptor()).addPathPatterns("/**"); registry.addInterceptor(GlobalInterceptor()).addPathPatterns("/**");
registry.addInterceptor(signInterceptor()).addPathPatterns("/open/**");//只拦截open前缀的接口
registry.addInterceptor(DevInterceptor()).addPathPatterns("/swagger-ui.html").addPathPatterns("/magic/**"); registry.addInterceptor(DevInterceptor()).addPathPatterns("/swagger-ui.html").addPathPatterns("/magic/**");
} }
@ -61,9 +47,8 @@ public class WebMvcConfig implements WebMvcConfigurer {
// .allowedOrigins("*") // .allowedOrigins("*")
.allowedOriginPatterns("*") .allowedOriginPatterns("*")
.allowCredentials(true) .allowCredentials(true)
.allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS") .allowedMethods("GET","HEAD","POST","PUT","DELETE","OPTIONS")
.maxAge(3600) .maxAge(3600);
;
} }
/* /*
@ -84,15 +69,4 @@ public class WebMvcConfig implements WebMvcConfigurer {
registry.addResourceHandler("doc.html").addResourceLocations( registry.addResourceHandler("doc.html").addResourceLocations(
"classpath:knife4j/"); "classpath:knife4j/");
} }
@SuppressWarnings({ "rawtypes", "unchecked" })
@Bean
public FilterRegistrationBean someFilterRegistration()
{
FilterRegistrationBean registration = new FilterRegistrationBean();
registration.setFilter(new RepeatedlyReadFilter());
registration.addUrlPatterns("/*");
registration.setName("repeatableFilter");
registration.setOrder(Ordered.LOWEST_PRECEDENCE);
return registration;
}
} }

@ -3,11 +3,7 @@ package com.currency.appengine.controller;
import cn.hutool.captcha.CaptchaUtil; import cn.hutool.captcha.CaptchaUtil;
import cn.hutool.captcha.LineCaptcha; import cn.hutool.captcha.LineCaptcha;
import com.currency.appengine.annotation.CheckToken; import com.currency.appengine.annotation.CheckToken;
import com.currency.appengine.domain.CustomerReq;
import com.currency.appengine.domain.SupplierReq;
import com.currency.appengine.domain.system.SysParam; import com.currency.appengine.domain.system.SysParam;
import com.currency.appengine.service.system.CustomerService;
import com.currency.appengine.service.system.SupplierService;
import com.currency.appengine.service.system.SysMenuService; import com.currency.appengine.service.system.SysMenuService;
import com.currency.appengine.service.system.SysParamService; import com.currency.appengine.service.system.SysParamService;
import com.currency.appengine.service.system.SysRoleService; import com.currency.appengine.service.system.SysRoleService;
@ -16,20 +12,16 @@ import com.currency.appengine.utils.JsonUtil;
import com.currency.appengine.utils.ReqParamsUtil; import com.currency.appengine.utils.ReqParamsUtil;
import com.currency.appengine.utils.Result; import com.currency.appengine.utils.Result;
import com.currency.appengine.utils.StringUtil; import com.currency.appengine.utils.StringUtil;
import java.util.ArrayList; import org.springframework.beans.factory.annotation.Autowired;
import java.util.List; import org.springframework.web.bind.annotation.*;
import java.util.Map;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired; import java.util.ArrayList;
import org.springframework.web.bind.annotation.GetMapping; import java.util.List;
import org.springframework.web.bind.annotation.PostMapping; import java.util.Map;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/** /**
* @date 2021/07/25 * @date 2021/07/25
@ -37,7 +29,6 @@ import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("/sys/authority") @RequestMapping("/sys/authority")
public class SystemController { public class SystemController {
@Autowired @Autowired
SysUserService sysUserService; SysUserService sysUserService;
@Autowired @Autowired
@ -46,14 +37,10 @@ public class SystemController {
SysRoleService sysRoleService; SysRoleService sysRoleService;
@Autowired @Autowired
SysParamService sysParamService; SysParamService sysParamService;
@Autowired
CustomerService customerService;
@Autowired
SupplierService supplierService;
/* /*
* *
* */ * */
@RequestMapping("/kaptcha") @RequestMapping("/kaptcha")
public void getKaptchaImage(HttpServletRequest request, HttpServletResponse response) throws Exception { public void getKaptchaImage(HttpServletRequest request, HttpServletResponse response) throws Exception {
HttpSession session = request.getSession(); HttpSession session = request.getSession();
@ -77,7 +64,6 @@ public class SystemController {
/** /**
* *
*
* @param params * @param params
* @return * @return
*/ */
@ -96,10 +82,10 @@ public class SystemController {
if (StringUtil.notEmpty(session.getAttribute("KAPTCHA_SESSION_KEY"))) { if (StringUtil.notEmpty(session.getAttribute("KAPTCHA_SESSION_KEY"))) {
String vercode = String.valueOf(params.get("verifycode")); String vercode = String.valueOf(params.get("verifycode"));
if (!code.equals(vercode)) { if (!code.equals(vercode)) {
return Result.fail(-14, "验证码错误"); return Result.fail(-14,"验证码错误");
} }
} else { } else {
return Result.fail(-14, "验证码错误"); return Result.fail(-14,"验证码错误");
} }
return sysUserService.userLogin(params); return sysUserService.userLogin(params);
} }
@ -178,7 +164,6 @@ public class SystemController {
/** /**
* *
*
* @return * @return
*/ */
@GetMapping("/role/list/all") @GetMapping("/role/list/all")
@ -250,13 +235,12 @@ public class SystemController {
/** /**
* *
*
* @return * @return
*/ */
@GetMapping("/menu/list/all") @GetMapping("/menu/list/all")
@CheckToken @CheckToken
public Result menuListAll() { public Result menuListAll() {
return sysMenuService.getRouterListAll(); return sysMenuService.getRouterListAll();
} }
@PostMapping("/menu/add") @PostMapping("/menu/add")
@ -336,25 +320,4 @@ public class SystemController {
public Result cacheUpdate() { public Result cacheUpdate() {
return sysParamService.cacheUpdate(); return sysParamService.cacheUpdate();
} }
/**
*
*/
@PostMapping("/customer/add")
@CheckToken
public Result addCustomer(HttpServletRequest request, @RequestBody CustomerReq customerReq) {
String userId = StringUtil.objectToString(request.getAttribute("openid"));
customerReq.setUserId(userId);
return Result.suc(customerService.addCustomer(customerReq));
}
/**
*
*/
@PostMapping("/supplier/add")
@CheckToken
public Result addSupplier(HttpServletRequest request, @RequestBody SupplierReq supplierReq) {
String userId = StringUtil.objectToString(request.getAttribute("openid"));
supplierReq.setUserId(userId);
return Result.suc(supplierService.addSupplier(supplierReq));
}
} }

@ -56,7 +56,7 @@ public class GlobalInterceptor implements HandlerInterceptor {
log.info(">>>>>>>Call before request processing (check token) "); log.info(">>>>>>>Call before request processing (check token) ");
Map<String, String> headers = HttpUtil.getHeadersInfo(request); Map<String, String> headers = HttpUtil.getHeadersInfo(request);
String token = headers.get("authorization"); String token = headers.get("authorization");;
if (token == null || token.isEmpty()) { if (token == null || token.isEmpty()) {
HttpUtil.returnJson(response, JsonUtil.generate(Result.fail(-2, "result.not_token"))); HttpUtil.returnJson(response, JsonUtil.generate(Result.fail(-2, "result.not_token")));
log.info(">>>>>>>check token fail"); log.info(">>>>>>>check token fail");

@ -25,12 +25,13 @@ public class CommonServices {
/** /**
* *
*
* @param type * @param type
* @param data * @param data
* @return * @return
*/ */
public String getCode(String type, Map<String, Object> data) { public String getCode(String type, Map<String, Object> data) {
Map<String, Function<Map<String, Object>,String>> grantTypeMap = new HashMap<>(); Map<String, Function<Map<String, Object>, String>> grantTypeMap = new HashMap<>();
grantTypeMap.put("CustomerCode", params -> customerCode(params)); // 客户编码 grantTypeMap.put("CustomerCode", params -> customerCode(params)); // 客户编码
grantTypeMap.put("SupplierCode", params -> supplierCode(params)); // 供应商编码 grantTypeMap.put("SupplierCode", params -> supplierCode(params)); // 供应商编码
@ -38,11 +39,12 @@ public class CommonServices {
grantTypeMap.put("OrderNumber", params -> orderNumber(params)); // 订单编号 grantTypeMap.put("OrderNumber", params -> orderNumber(params)); // 订单编号
grantTypeMap.put("ProductionPlan", params -> productionPlan(params)); // 生产计划 grantTypeMap.put("ProductionPlan", params -> productionPlan(params)); // 生产计划
grantTypeMap.put("ProductionSchedulingNumber", params -> productionSchedulingNumber(params)); // 排产编号 grantTypeMap.put("ProductionSchedulingNumber", params -> productionSchedulingNumber(params)); // 排产编号
grantTypeMap.put("ProductionOrderNumber", params -> productionOrderNumber(params)); // 报工单号 grantTypeMap.put("ProductionOrderNumber", params -> productionOrderNumber(params)); // 报工单号 -- 废弃
grantTypeMap.put("ProductionOrderNumberSub", params -> productionOrderNumberSub(params)); // 报工单号 -- 细分
grantTypeMap.put("PurchaseNumber", params -> purchaseNumber(params)); // 采购编号 grantTypeMap.put("PurchaseNumber", params -> purchaseNumber(params)); // 采购编号
Function<Map<String, Object>,String> result = grantTypeMap.get(type); Function<Map<String, Object>, String> result = grantTypeMap.get(type);
if(result!=null){ if (result != null) {
//传入resourceId 执行这段表达式获得String型的grantType //传入resourceId 执行这段表达式获得String型的grantType
return result.apply(data); return result.apply(data);
} }
@ -52,6 +54,7 @@ public class CommonServices {
/** /**
* C+5 * C+5
* mini_customer_info * mini_customer_info
*
* @param params * @param params
* @return * @return
*/ */
@ -77,6 +80,7 @@ public class CommonServices {
/** /**
* V+5 * V+5
*
* @param params * @param params
* @return * @return
*/ */
@ -103,6 +107,7 @@ public class CommonServices {
/** /**
* ++3SW20240929-001SW20240929-002SW20240929-003..) * ++3SW20240929-001SW20240929-002SW20240929-003..)
*
* @param params * @param params
* @return * @return
*/ */
@ -121,6 +126,7 @@ public class CommonServices {
/** /**
* +0010100102 * +0010100102
*
* @param params * @param params
* @return * @return
*/ */
@ -138,6 +144,7 @@ public class CommonServices {
/** /**
* :P+3 * :P+3
*
* @param params * @param params
* @return * @return
*/ */
@ -154,6 +161,7 @@ public class CommonServices {
/** /**
* JY+3 * JY+3
*
* @param params * @param params
* @return * @return
*/ */
@ -170,6 +178,7 @@ public class CommonServices {
/** /**
* BG++3 * BG++3
*
* @param params * @param params
* @return * @return
*/ */
@ -184,8 +193,47 @@ public class CommonServices {
} }
} }
/**
* BG++3
*
* @param params
* @return
*/
public String productionOrderNumberSub(Map<String, Object> params) {
String currentProcess = String.valueOf(params.get("currentProcess"));
try {
return LockUtils.doWithLock(() -> {
int count = commonMapper.count("mini_process_report", "date(create_time) = curdate() and current_process=#{currentProcess}",
new HashMap() {{
put("currentProcess", currentProcess);
}});
switch (currentProcess) {
case "jiya":
return "JY" + DateUtil.getYyMMdd() + formatNumber(count, "2");
case "dk":
return "DK" + DateUtil.getYyMMdd() + formatNumber(count, "2");
case "jingpin":
return "JP" + DateUtil.getYyMMdd() + formatNumber(count, "2");
case "yanghau1":
return "YH" + DateUtil.getYyMMdd() + formatNumber(count, "2");
case "yanghua2":
return "YHH" + DateUtil.getYyMMdd() + formatNumber(count, "2");
case "jingqie":
return "JQ" + DateUtil.getYyMMdd() + formatNumber(count, "2");
case "bz":
return "BZ" + DateUtil.getYyMMdd() + formatNumber(count, "2");
default:
return "BG" + DateUtil.getYyyyMMdd() + formatNumber(count, "3");
}
});
} catch (Exception e) {
return null;
}
}
/** /**
* PO++ * PO++
*
* @param params * @param params
* @return * @return
*/ */
@ -216,6 +264,7 @@ public class CommonServices {
} }
return pinyinFirstLetters.toString(); return pinyinFirstLetters.toString();
} }
public static void main(String[] arg) { public static void main(String[] arg) {
// int sequenceNumber = 123456; // 假设这是你的序号 // int sequenceNumber = 123456; // 假设这是你的序号
// String formattedSequence = String.format("%05d", sequenceNumber); // String formattedSequence = String.format("%05d", sequenceNumber);

@ -16,6 +16,7 @@ public class DateUtil {
private final static SimpleDateFormat FORMAT_yyyyMMddHHmmss = new SimpleDateFormat("yyyyMMddHHmmss"); private final static SimpleDateFormat FORMAT_yyyyMMddHHmmss = new SimpleDateFormat("yyyyMMddHHmmss");
private final static SimpleDateFormat FORMAT_yyyyMMdd = new SimpleDateFormat("yyyyMMdd"); private final static SimpleDateFormat FORMAT_yyyyMMdd = new SimpleDateFormat("yyyyMMdd");
private final static SimpleDateFormat FORMAT_yyMMdd = new SimpleDateFormat("yyMMdd");
/** /**
* yyyy-MM-dd HH:mm:ss * yyyy-MM-dd HH:mm:ss
* @param timeStr * @param timeStr
@ -90,6 +91,10 @@ public class DateUtil {
return FORMAT_yyyyMMdd.format(new Date()); return FORMAT_yyyyMMdd.format(new Date());
} }
public static String getYyMMdd() {
return FORMAT_yyMMdd.format(new Date());
}
/** /**
* *
* @param format yyyy-MM-dd HH:mm:ss * @param format yyyy-MM-dd HH:mm:ss

@ -5,7 +5,7 @@
"groupId" : "681f3a382ebf4b45a94a17bf7c967968", "groupId" : "681f3a382ebf4b45a94a17bf7c967968",
"name" : "新增", "name" : "新增",
"createTime" : null, "createTime" : null,
"updateTime" : 1726408511094, "updateTime" : 1731567501231,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,

@ -5,7 +5,7 @@
"groupId" : "4aa6b5de02c244e2981c22bf5a95394d", "groupId" : "4aa6b5de02c244e2981c22bf5a95394d",
"name" : "新增", "name" : "新增",
"createTime" : null, "createTime" : null,
"updateTime" : 1729160184169, "updateTime" : 1731737780581,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -73,6 +73,7 @@ try{
actual_weight: marerial.actualWeight, actual_weight: marerial.actualWeight,
unstocked_quantity: marerial.unstockedQuantity, unstocked_quantity: marerial.unstockedQuantity,
stocked_quantity: marerial.stockedQuantity, stocked_quantity: marerial.stockedQuantity,
order_no: marerial.orderNo,
create_by: createBy create_by: createBy
}) })
}) })
@ -162,27 +163,52 @@ try{
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
packing_quantity = CASE packing_quantity = CASE
<foreach collection="materialsList" item="item" separator=" "> <foreach collection="materialsList" item="item" separator=" ">
WHEN material_code = #{item.materialCode} and sales_order_code = #{item.salesOrderCode} and warehouse = #{item.warehouse} THEN packing_quantity + #{item.warehouseQuantity} WHEN material_code = #{item.materialCode} and sales_order_code = #{item.salesOrderCode}
and warehouse = #{item.warehouse} and order_no = #{item.orderNo}
THEN packing_quantity + #{item.warehouseQuantity}
</foreach> </foreach>
ELSE packing_quantity ELSE packing_quantity
END, END,
existing_inventory = CASE existing_inventory = CASE
<foreach collection="materialsList" item="item" separator=" "> <foreach collection="materialsList" item="item" separator=" ">
WHEN material_code = #{item.materialCode} and sales_order_code = #{item.salesOrderCode} and warehouse = #{item.warehouse} THEN existing_inventory + #{item.receiptQuantity} WHEN material_code = #{item.materialCode} and sales_order_code = #{item.salesOrderCode}
and warehouse = #{item.warehouse} and order_no = #{item.orderNo}
THEN existing_inventory + #{item.receiptQuantity}
</foreach> </foreach>
ELSE existing_inventory ELSE existing_inventory
END, END,
actual_weight = CASE actual_weight = CASE
<foreach collection="materialsList" item="item" separator=" "> <foreach collection="materialsList" item="item" separator=" ">
WHEN material_code = #{item.materialCode} and sales_order_code = #{item.salesOrderCode} and warehouse = #{item.warehouse} THEN actual_weight + #{item.actualWeight} WHEN material_code = #{item.materialCode} and sales_order_code = #{item.salesOrderCode}
and order_no = #{item.orderNo} and warehouse = #{item.warehouse}
THEN actual_weight + #{item.actualWeight}
</foreach> </foreach>
ELSE actual_weight ELSE actual_weight
END END
""") """)
if (res > 0) { if (res > 0) {
tx.commit(); // 提交事务 // 更新报工中已入库的数量
exit 0, "执行成功", null; res = db.update("""
update mini_process_report
SET stock_quantity = CASE
<foreach collection="materialsList" item="item" separator=" ">
WHEN material_code = #{item.materialCode} and sales_order_code = #{item.salesOrderCode}
and order_no = #{item.orderNo}
THEN stock_quantity + #{item.receiptQuantity}
</foreach>
ELSE stock_quantity
END
WHERE is_completed = 1 and sales_order_code in (
<foreach collection="materialsList" item="item" separator=",">
#{item.salesOrderCode}
</foreach>
)
""")
if (res > 0) {
tx.commit(); // 提交事务
exit 0, "执行成功", null;
}
} }
} }
tx.rollback(); tx.rollback();

@ -5,7 +5,7 @@
"groupId" : "4aa6b5de02c244e2981c22bf5a95394d", "groupId" : "4aa6b5de02c244e2981c22bf5a95394d",
"name" : "详情", "name" : "详情",
"createTime" : null, "createTime" : null,
"updateTime" : 1729153406281, "updateTime" : 1731567422340,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -52,7 +52,7 @@ return {
${warehouseProductMaterial} ${warehouseProductMaterial}
from mini_product_receipt mpr from mini_product_receipt mpr
left join mini_warehouse_product mwp on mwp.sales_order_code = mpr.sales_order_code left join mini_warehouse_product mwp on mwp.sales_order_code = mpr.sales_order_code
and mwp.material_code = mpr.material_code and mwp.material_code = mpr.material_code and mwp.order_no = mpr.order_no
where 1=1 where 1=1
and mpr.document_number = #{documentNumber} and mpr.document_number = #{documentNumber}
"""), """),

@ -5,7 +5,7 @@
"groupId" : "06bb1cef20924ed8887b1c3ae8a91d3a", "groupId" : "06bb1cef20924ed8887b1c3ae8a91d3a",
"name" : "修改", "name" : "修改",
"createTime" : null, "createTime" : null,
"updateTime" : 1729144854213, "updateTime" : 1731737082705,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -25,10 +25,10 @@
"expression" : null, "expression" : null,
"children" : null "children" : null
} ], } ],
"requestBody" : "{\r\n \"id\": 2,\r\n \"productionNumber\": 12,\r\n \"productionWeight\": 12,\r\n \"scrapNumber\": 12,\r\n \"scrapReason\": \"243\",\r\n \"frameNumber\": \"123\",\r\n \"nextProcess\": \"yanghua\",\r\n \"isCompleted\": \"\",\r\n \"remarks\": \"11\",\r\n \"reportNumber\": \"20240807\",\r\n \"machine\": \"测试机台2\",\r\n \"operator\": \"张三\",\r\n \"workshop\": \"挤压车间2\",\r\n \"reportDate\": \"2024-09-02 00:00:00\",\r\n \"currentProcess\": \"挤压报工\"\r\n}", "requestBody" : "{\r\n \"id\": 2772,\r\n \"productionNumber\": 100,\r\n \"productionWeight\": 100,\r\n \"scrapNumber\": 0,\r\n \"scrapReason\": null,\r\n \"frameNumber\": null,\r\n \"nextProcess\": \"yanghua2\",\r\n \"isCompleted\": 0,\r\n \"remarks\": \"\",\r\n \"reportNumber\": \"JY24111500\",\r\n \"machine\": null,\r\n \"operator\": null,\r\n \"workshop\": null,\r\n \"reportDate\": \"2024-11-15\",\r\n \"currentProcess\": \"jiya\",\r\n \"salesOrderCode\": \"KFCS20241114-000\",\r\n \"scheduleNumber\": \"JY20241115006\",\r\n \"profileModel\": \"6430-120\",\r\n \"moldCode\": null,\r\n \"moldModel\": null,\r\n \"moldThickness\": null,\r\n \"moldManufacturer\": null,\r\n \"moldColor\": null,\r\n \"moldChangeReason\": null,\r\n \"rodCount\": null\r\n}",
"headers" : [ { "headers" : [ {
"name" : "authorization", "name" : "authorization",
"value" : "5E34C0D7EA601026B93C26119C7E1AD59CF35D76F0DCA5272366FC6A87E41372412D8F4473A6A7BD5E5C1D4E94AEFD40", "value" : "5E34C0D7EA601026B93C26119C7E1AD5304936225AC6AC0DD5E00182C1DF3624BE38DB349BDC91696CBC04B5F9AB5B53",
"description" : "登录token", "description" : "登录token",
"required" : false, "required" : false,
"dataType" : "String", "dataType" : "String",
@ -40,12 +40,14 @@
"children" : null "children" : null
} ], } ],
"paths" : [ ], "paths" : [ ],
"responseBody" : "{\n \"code\": -2,\n \"message\": \"token无效\",\n \"data\": null,\n \"timestamp\": 1726813009589,\n \"executeTime\": null\n}", "responseBody" : "{\n \"code\": 0,\n \"data\": null,\n \"message\": \"success\"\n}",
"description" : null, "description" : null,
"requestBodyDefinition" : null, "requestBodyDefinition" : null,
"responseBodyDefinition" : null "responseBodyDefinition" : null
} }
================================ ================================
import 'commonServices' as CommonServices
String id = body.id; String id = body.id;
String productionNumber = body.productionNumber; String productionNumber = body.productionNumber;
String productionWeight = body.productionWeight; String productionWeight = body.productionWeight;
@ -53,10 +55,23 @@ String scrapNumber = body.scrapNumber;
String scrapReason = body.scrapReason; String scrapReason = body.scrapReason;
String frameNumber = body.frameNumber; String frameNumber = body.frameNumber;
String nextProcess = body.nextProcess; String nextProcess = body.nextProcess;
String netReceipts = body.netReceipts;
String isCompleted = body.isCompleted; String isCompleted = body.isCompleted;
String remarks = body.remarks; String remarks = body.remarks;
Map map = db.selectOne("select * from mini_process_report where id=#{id}") String remarks = body.remarks;
Map map = db.selectOne("""
select mpr.*,
mesd.production_length,
mesd.production_pieces,
mesd.sawing_method
from mini_process_report mpr
left join mini_extrusion_schedule_detail mesd
on mpr.sales_order_code = mesd.sales_order_code and mpr.material_code = mesd.material_code and mpr.order_no = mesd.order_no
where mpr.id=#{id}
""")
var tx = db.transaction() var tx = db.transaction()
try { try {
@ -68,24 +83,49 @@ try {
scrap_number: scrapNumber, scrap_number: scrapNumber,
scrap_reason: scrapReason, scrap_reason: scrapReason,
frame_number: frameNumber, frame_number: frameNumber,
net_receipts: netReceipts,
next_process: nextProcess, next_process: nextProcess,
is_completed: isCompleted, is_completed: isCompleted,
remarks: remarks, remarks: remarks,
}) })
if (res <= 0) { if (res <= 0) {
tx.rollback(); tx.rollback();
exit -1, "失败" exit - 1, "失败"
} }
if ((Objects.isNull(nextProcess) || nextProcess == "")) { // if ((Objects.isNull(nextProcess) || nextProcess == "")) {
// if (isCompleted == 1) {
// // 完成更新
// }
// tx.commit()
// return;
// }
if (isCompleted == 1) { if (isCompleted == 1) {
// 完成更新
}
// 更新订单表中的生产数量
res = db.update("""
update mini_sales_order_materials
SET produced_pieces = produced_pieces + #{map.productionPieces},
produced_length = produced_length + #{map.productionLength}
WHERE material_code = #{map.materialCode} and sales_order_code = #{map.salesOrderCode}
and order_no = #{map.orderNo}
""")
// 完成更新
tx.commit() tx.commit()
return; return;
} }
// 自动生成编码
Map codeParams = new HashMap();
codeParams.put("currentProcess", nextProcess);
map.reportNumber = CommonServices.getCode("ProductionOrderNumberSub", codeParams)
// 插入新工序 // 插入新工序
res = db.table("mini_process_report").insert({ res = db.table("mini_process_report").insert({
schedule_number: map.scheduleNumber, schedule_number: map.scheduleNumber,
@ -99,8 +139,16 @@ try {
source_number: productionNumber, source_number: productionNumber,
net_receipts: productionNumber, net_receipts: productionNumber,
sales_order_code: map.salesOrderCode, sales_order_code: map.salesOrderCode,
order_no: map.orderNo,
material_code: map.materialCode, material_code: map.materialCode,
frame_number: map.frameNumber, frame_number: map.frameNumber,
mold_code: map.moldCode,
mold_model: map.moldModel,
mold_thickness: map.moldThickness,
mold_manufacturer: map.moldManufacturer,
mold_color: map.moldColor,
mold_change_reason: map.moldChangeReason,
rod_count: map.rodCount,
}) })
if (res > 0) { if (res > 0) {
@ -108,9 +156,10 @@ try {
return; return;
} }
tx.rollback(); tx.rollback();
exit -1, "失败" exit - 1, "失败"
return; return;
} catch(e) { } catch (e) {
print(e.getMessage())
tx.rollback() tx.rollback()
exit -1, "失败" exit - 1, "失败"
} }

@ -5,7 +5,7 @@
"groupId" : "06bb1cef20924ed8887b1c3ae8a91d3a", "groupId" : "06bb1cef20924ed8887b1c3ae8a91d3a",
"name" : "列表", "name" : "列表",
"createTime" : null, "createTime" : null,
"updateTime" : 1730109402968, "updateTime" : 1731729532436,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -57,10 +57,13 @@ report_date
String salesOrderCode = body.salesOrderCode; String salesOrderCode = body.salesOrderCode;
String scheduleNumber = body.scheduleNumber; String scheduleNumber = body.scheduleNumber;
String reportNumber = body.reportNumber; String reportNumber = body.reportNumber;
String currentProcess = body.currentProcess; String currentProcess = body.currentProcess; // 当前工序
String reportDate = body.reportDate; String reportDate = body.reportDate;
String profileModel = body.profileModel; String profileModel = body.profileModel;
// 产品代码 型材型号 物料名称 规格型号 壁厚 米重
// 订单长度M 表面方式 订单总数 排产长度(m) 排产支数 排产日期 锯切方式 交货日期
var sql = """ var sql = """
select select
mpr.id, mpr.id,
@ -79,10 +82,33 @@ mpr.frame_number,
mpr.is_completed, mpr.is_completed,
mpr.sales_order_code, mpr.sales_order_code,
mpr.schedule_number, mpr.schedule_number,
msm.profile_model mpr.source_number,
mpr.net_receipts,
mpr.mold_code,
mpr.mold_model,
mpr.mold_thickness,
mpr.mold_manufacturer,
mpr.mold_color,
mpr.mold_change_reason,
mpr.rod_count,
mesd.production_length,
mesd.production_pieces,
mesd.sawing_method,
msm.profile_model,
msm.weight,
msm.specification,
msm.thickness,
msm.order_length,
msm.order_total_quantity,
msm.surface_method,
date_format(msm.delivery_date, '%Y-%m-%d') as delivery_date,
msm.material_code,
msm.material_name
from mini_process_report mpr from mini_process_report mpr
left join mini_extrusion_schedule_detail mesd
on mpr.sales_order_code = mesd.sales_order_code and mpr.material_code = mesd.material_code and mpr.order_no = mesd.order_no
left join mini_sales_order_materials msm left join mini_sales_order_materials msm
on mpr.sales_order_code = msm.sales_order_code and mpr.material_code = msm.material_code on mpr.sales_order_code = msm.sales_order_code and mpr.material_code = msm.material_code and mpr.order_no = msm.order_no
where 1 = 1 where 1 = 1
-- and next_process is null -- and next_process is null
?{salesOrderCode != null and salesOrderCode != '', and mpr.sales_order_code like concat('%', #{salesOrderCode}, '%')} ?{salesOrderCode != null and salesOrderCode != '', and mpr.sales_order_code like concat('%', #{salesOrderCode}, '%')}

@ -5,7 +5,7 @@
"groupId" : "06bb1cef20924ed8887b1c3ae8a91d3a", "groupId" : "06bb1cef20924ed8887b1c3ae8a91d3a",
"name" : "新增", "name" : "新增",
"createTime" : null, "createTime" : null,
"updateTime" : 1728723877581, "updateTime" : 1731736113438,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -55,9 +55,11 @@ String userId = StringUtil.objectToString(request.get().getAttribute("openid"));
// 查询数据库获取对应 userId 的用户名 // 查询数据库获取对应 userId 的用户名
String createBy = db.selectOne("""SELECT user_name FROM sys_user WHERE user_id = #{userId}""").userName; String createBy = db.selectOne("""SELECT user_name FROM sys_user WHERE user_id = #{userId}""").userName;
orderInfo.currentProcess = "jiya"
if (orderInfo.isAuto) { if (orderInfo.isAuto) {
// 自动生成编码 // 自动生成编码
orderInfo.reportNumber = CommonServices.getCode("ProductionOrderNumber", orderInfo) orderInfo.reportNumber = CommonServices.getCode("ProductionOrderNumberSub", orderInfo)
} }
@ -73,8 +75,16 @@ try{
report_date: orderInfo.reportDate, report_date: orderInfo.reportDate,
current_process: orderInfo.currentProcess, current_process: orderInfo.currentProcess,
sales_order_code: materialsList.get(0).salesOrderCode, sales_order_code: materialsList.get(0).salesOrderCode,
order_no: materialsList.get(0).orderNo,
material_code: materialsList.get(0).materialCode, material_code: materialsList.get(0).materialCode,
remarks: orderInfo.remarks, remarks: orderInfo.remarks,
mold_code: materialsList.get(0).moldCode,
mold_model: materialsList.get(0).moldModel,
mold_thickness: materialsList.get(0).moldThickness,
mold_manufacturer: materialsList.get(0).moldManufacturer,
mold_color: materialsList.get(0).moldColor,
mold_change_reason: materialsList.get(0).moldChangeReason,
rod_count: materialsList.get(0).rodCount,
create_by: createBy create_by: createBy
}) })

@ -5,7 +5,7 @@
"groupId" : "06bb1cef20924ed8887b1c3ae8a91d3a", "groupId" : "06bb1cef20924ed8887b1c3ae8a91d3a",
"name" : "查询完成的列表", "name" : "查询完成的列表",
"createTime" : null, "createTime" : null,
"updateTime" : 1729148530659, "updateTime" : 1731737540782,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -50,11 +50,12 @@ return db.page("""
mpr.frame_number, mpr.frame_number,
mpr.scrap_reason, mpr.scrap_reason,
mpr.remarks , mpr.remarks ,
mpr.stock_quantity,
${salesOrdeSelect} ${salesOrdeSelect}
from mini_process_report mpr from mini_process_report mpr
left join mini_sales_order_materials msm left join mini_sales_order_materials msm
on mpr.sales_order_code = msm.sales_order_code and mpr.material_code = msm.material_code on mpr.sales_order_code = msm.sales_order_code and mpr.material_code = msm.material_code and mpr.order_no = msm.order_no
where mpr.is_completed = 1 where mpr.is_completed = 1 and (mpr.production_number - mpr.stock_quantity) > 0
?{salesOrderCode != null and salesOrderCode != '', and mpr.sales_order_code like concat('%', #{salesOrderCode}, '%')} ?{salesOrderCode != null and salesOrderCode != '', and mpr.sales_order_code like concat('%', #{salesOrderCode}, '%')}
?{materialCode != null and materialCode != '', and mpr.material_code like concat('%', #{materialCode}, '%')} ?{materialCode != null and materialCode != '', and mpr.material_code like concat('%', #{materialCode}, '%')}
""") """)

@ -5,7 +5,7 @@
"groupId" : "f4b3acf704cf4db29258ba70e24f8fc5", "groupId" : "f4b3acf704cf4db29258ba70e24f8fc5",
"name" : "修改", "name" : "修改",
"createTime" : null, "createTime" : null,
"updateTime" : 1728727443545, "updateTime" : 1731567308993,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -75,6 +75,7 @@ try{
list.add({ list.add({
schedule_number: orderInfo.scheduleNumber, schedule_number: orderInfo.scheduleNumber,
sales_order_code: marerial.salesOrderCode, sales_order_code: marerial.salesOrderCode,
order_no: marerial.orderNo,
material_code: marerial.materialCode, material_code: marerial.materialCode,
production_length: marerial.productionLength, production_length: marerial.productionLength,
production_pieces: marerial.productionPieces, production_pieces: marerial.productionPieces,

@ -5,7 +5,7 @@
"groupId" : "f4b3acf704cf4db29258ba70e24f8fc5", "groupId" : "f4b3acf704cf4db29258ba70e24f8fc5",
"name" : "新增", "name" : "新增",
"createTime" : null, "createTime" : null,
"updateTime" : 1728726723475, "updateTime" : 1731651357563,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -76,33 +76,12 @@ try{
if (res > 0) { if (res > 0) {
println("挤压排产单插入成功") println("挤压排产单插入成功")
// res = db.update("""
// update mini_production_schedule
// SET productioned_pieces = CASE
// <foreach collection="materialsList" item="item" separator=" ">
// WHEN material_code = #{item.materialCode} and sales_order_code = #{purchInfo.documentNumber} THEN productioned_pieces + #{item.productionPieces}
// </foreach>
// ELSE productioned_pieces
// END
// WHERE (sales_order_code, material_code) in (
// <foreach collection="materialsList" item="item" separator=",">
// (#{purchInfo.documentNumber}, #{item.materialCode})
// </foreach>
// )
// """)
// if (res <= 0) {
// tx.rollback();
// println("更新计划表失败")
// exit -1, "提交失败";
// }
List list = new ArrayList(); List list = new ArrayList();
List list2 = new ArrayList();
materialsList.map(marerial => { materialsList.map(marerial => {
list.add({ list.add({
schedule_number: orderInfo.scheduleNumber, schedule_number: orderInfo.scheduleNumber,
sales_order_code: marerial.salesOrderCode, sales_order_code: marerial.salesOrderCode,
order_no: marerial.orderNo,
material_code: marerial.materialCode, material_code: marerial.materialCode,
production_length: marerial.productionLength, production_length: marerial.productionLength,
production_pieces: marerial.productionPieces, production_pieces: marerial.productionPieces,
@ -114,6 +93,29 @@ try{
res = db.table("mini_extrusion_schedule_detail").batchInsert(list) res = db.table("mini_extrusion_schedule_detail").batchInsert(list)
if (res > 0) { if (res > 0) {
// 更新计划排产信息
res = db.update("""
update mini_production_schedule
SET status = 1, productioned_pieces = CASE
<foreach collection="materialsList" item="item" separator=" ">
WHEN order_no = #{item.orderNo} and sales_order_code = #{item.salesOrderCode}
THEN productioned_pieces + #{item.productionPieces}
</foreach>
ELSE productioned_pieces
END
WHERE (sales_order_code, order_no) in (
<foreach collection="materialsList" item="item" separator=",">
(#{item.salesOrderCode}, #{item.orderNo})
</foreach>
)
""")
if (res <= 0) {
tx.rollback();
println("更新计划表失败", res)
exit -1, "提交失败";
}
tx.commit(); // 提交事务 tx.commit(); // 提交事务
exit 0, "执行成功", null; exit 0, "执行成功", null;
} }

@ -5,7 +5,7 @@
"groupId" : "f4b3acf704cf4db29258ba70e24f8fc5", "groupId" : "f4b3acf704cf4db29258ba70e24f8fc5",
"name" : "详情", "name" : "详情",
"createTime" : null, "createTime" : null,
"updateTime" : 1728728158049, "updateTime" : 1731567258141,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -59,7 +59,7 @@ return {
left join sys_user su on su.user_id = mso.salesperson 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_customer_info mci on mci.customer_code = mso.customer_id
left join mini_sales_order_materials msm left join mini_sales_order_materials msm
on mesd.sales_order_code = msm.sales_order_code and mesd.material_code = msm.material_code on mesd.sales_order_code = msm.sales_order_code and mesd.material_code = msm.material_code and mesd.order_no = msm.order_no
where 1=1 and mesd.schedule_number=#{scheduleNumber} where 1=1 and mesd.schedule_number=#{scheduleNumber}
"""), """),

@ -5,7 +5,7 @@
"groupId" : "f4b3acf704cf4db29258ba70e24f8fc5", "groupId" : "f4b3acf704cf4db29258ba70e24f8fc5",
"name" : "详情列表", "name" : "详情列表",
"createTime" : null, "createTime" : null,
"updateTime" : 1730452017745, "updateTime" : 1731567261894,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -557,7 +557,7 @@ return db.page("""
from from
mini_extrusion_schedule_detail mesd mini_extrusion_schedule_detail mesd
left join mini_sales_order_materials msm left join mini_sales_order_materials msm
on mesd.sales_order_code = msm.sales_order_code and mesd.material_code = msm.material_code on mesd.sales_order_code = msm.sales_order_code and mesd.material_code = msm.material_code and mesd.order_no = msm.order_no
where 1=1 where 1=1
?{scheduleNumber != null and scheduleNumber != '', and mesd.schedule_number like concat('%', #{scheduleNumber}, '%')} ?{scheduleNumber != null and scheduleNumber != '', and mesd.schedule_number like concat('%', #{scheduleNumber}, '%')}
?{salesOrderCode != null and salesOrderCode != '', and msm.sales_order_code like concat('%', #{salesOrderCode}, '%')} ?{salesOrderCode != null and salesOrderCode != '', and msm.sales_order_code like concat('%', #{salesOrderCode}, '%')}

@ -5,7 +5,7 @@
"groupId" : "06d35cc5db5f4e6681262a1648c871c3", "groupId" : "06d35cc5db5f4e6681262a1648c871c3",
"name" : "修改", "name" : "修改",
"createTime" : null, "createTime" : null,
"updateTime" : 1726362872013, "updateTime" : 1731567452397,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -50,10 +50,11 @@ String salesOrderCode = body.salesOrderCode;
String materialCode = body.materialCode; String materialCode = body.materialCode;
String plannedPieces = body.plannedPieces; String plannedPieces = body.plannedPieces;
String remarks = body.remarks; String remarks = body.remarks;
String orderNo = body.orderNo;
return db.update(""" return db.update("""
update mini_production_schedule set update mini_production_schedule set
planned_pieces=#{plannedPieces}, planned_pieces=#{plannedPieces},
remarks = #{remarks} remarks = #{remarks}
where sales_order_code=#{salesOrderCode} and material_code=#{materialCode} where sales_order_code=#{salesOrderCode} and material_code=#{materialCode} and order_no=#{orderNo}
""") """)

@ -5,7 +5,7 @@
"groupId" : "06d35cc5db5f4e6681262a1648c871c3", "groupId" : "06d35cc5db5f4e6681262a1648c871c3",
"name" : "列表", "name" : "列表",
"createTime" : null, "createTime" : null,
"updateTime" : 1730451538439, "updateTime" : 1731643614960,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -165,6 +165,8 @@ String deliveryDate = body["deliveryDate"];
String customerName = body["customerName"]; String customerName = body["customerName"];
String orderNo = body["orderNo"]; String orderNo = body["orderNo"];
String orderStatus = body["orderStatus"]; // 订单状态
String salesOrdeSelect = sql("salesOrder") String salesOrdeSelect = sql("salesOrder")
String sql = """ String sql = """
select select
@ -179,6 +181,7 @@ String sql = """
mso.pricing_date, mso.pricing_date,
mso.tax_rate, mso.tax_rate,
mso.processing_fee, mso.processing_fee,
mps.status as plan_status,
${salesOrdeSelect} ${salesOrdeSelect}
from from
mini_production_schedule mps mini_production_schedule mps
@ -186,7 +189,7 @@ String sql = """
left join sys_user su on su.user_id = mso.salesperson 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_customer_info mci on mci.customer_code = mso.customer_id
left join mini_sales_order_materials msm left join mini_sales_order_materials msm
on mps.sales_order_code = msm.sales_order_code and mps.material_code = msm.material_code on mps.sales_order_code = msm.sales_order_code and mps.material_code = msm.material_code and mps.order_no = msm.order_no
where 1=1 where 1=1
?{salesOrderCode != null and salesOrderCode != "", and mps.sales_order_code = #{salesOrderCode}} ?{salesOrderCode != null and salesOrderCode != "", and mps.sales_order_code = #{salesOrderCode}}
?{documentNumber != null and documentNumber != "", and mps.document_number = #{documentNumber}} ?{documentNumber != null and documentNumber != "", and mps.document_number = #{documentNumber}}
@ -196,5 +199,6 @@ String sql = """
?{orderNo != null and orderNo != "", and msm.order_no like concat('%', #{orderNo}, '%')} ?{orderNo != null and orderNo != "", and msm.order_no like concat('%', #{orderNo}, '%')}
?{deliveryDate != null and deliveryDate != '', and mso.delivery_date = #{deliveryDate}} ?{deliveryDate != null and deliveryDate != '', and mso.delivery_date = #{deliveryDate}}
"""; """;
// ?{orderStatus != null and orderStatus != '', and mps.status = #{orderStatus}}
return db.page(sql); return db.page(sql);

@ -5,7 +5,7 @@
"groupId" : "06d35cc5db5f4e6681262a1648c871c3", "groupId" : "06d35cc5db5f4e6681262a1648c871c3",
"name" : "新增", "name" : "新增",
"createTime" : null, "createTime" : null,
"updateTime" : 1728724750705, "updateTime" : 1731575808607,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -48,11 +48,33 @@
================================ ================================
import 'commonServices' as CommonServices import 'commonServices' as CommonServices
List selection = body.selection; String type = body["type"];
Map orderInfo = body.orderInfo; Map orderInfo = body.orderInfo;
List selection = new ArrayList();
// 判断是否一键生成计划单
if (Objects.nonNull(type) && "once".equals(type)) {
// 一键生成计划单
// 获取订单物料信息
selection = db.select("""
select
msom.id,
msom.sales_order_code,
msom.material_code,
msom.order_no,
msom.order_total_quantity as planned_pieces
from mini_sales_order_materials msom
where 1=1 and msom.sales_order_code = #{orderInfo.documentNumber}
""")
} else {
selection = body['selection'];
}
Map form = body.form; Map form = body.form;
if (Objects.isNull(selection) || selection.size() <= 0) { if (Objects.isNull(selection) || selection.size() <= 0) {
exit -1, "数据为空" exit - 1, "数据为空"
} }
String userId = StringUtil.objectToString(request.get().getAttribute("openid")); String userId = StringUtil.objectToString(request.get().getAttribute("openid"));
@ -67,19 +89,20 @@ if (form.isAuto) {
} }
var tx = db.transaction(); //开启事务 var tx = db.transaction(); //开启事务
try{ try {
var res = db.insert(""" var res = db.insert("""
insert into mini_production_schedule( insert into mini_production_schedule(
document_number, document_number,
sales_order_code, sales_order_code,
order_no,
material_code, material_code,
planned_pieces, planned_pieces,
remarks, remarks,
create_by create_by
) values ) values
<foreach collection="selection" item="item" separator=","> <foreach collection="selection" item="item" separator=",">
(#{documentNumber}, #{orderInfo.documentNumber}, #{item.materialCode},#{item.plannedPieces},#{item.remarks},#{createBy}) (#{documentNumber}, #{orderInfo.documentNumber}, #{item.orderNo}, #{item.materialCode},#{item.plannedPieces},#{item.remarks},#{createBy})
</foreach> </foreach>
""") """)
if (res > 0) { if (res > 0) {
@ -88,10 +111,10 @@ try{
""") """)
var res2 = db.update(""" var res2 = db.update("""
update mini_sales_order_materials set status=1 update mini_sales_order_materials set status = 1
where (sales_order_code, material_code) in ( where (sales_order_code, order_no) in (
<foreach collection="selection" item="item" separator=","> <foreach collection="selection" item="item" separator=",">
(#{orderInfo.documentNumber}, #{item.materialCode}) (#{orderInfo.documentNumber}, #{item.orderNo})
</foreach> </foreach>
) )
""") """)
@ -102,11 +125,11 @@ try{
} }
} }
tx.rollback() tx.rollback()
exit -1, "失败" exit - 1, "失败"
} catch(e) { } catch (e) {
println(e) println(e)
tx.rollback() tx.rollback()
exit -1, "失败" exit - 1, "失败"
} }

@ -5,7 +5,7 @@
"groupId" : "06d35cc5db5f4e6681262a1648c871c3", "groupId" : "06d35cc5db5f4e6681262a1648c871c3",
"name" : "详情", "name" : "详情",
"createTime" : null, "createTime" : null,
"updateTime" : 1728721582011, "updateTime" : 1731567386509,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -35,7 +35,7 @@ String sql = """
from from
mini_production_schedule mps mini_production_schedule mps
left join mini_sales_order_materials msm left join mini_sales_order_materials msm
on mps.sales_order_code = msm.sales_order_code and mps.material_code = msm.material_code on mps.sales_order_code = msm.sales_order_code and mps.material_code = msm.material_code and mps.order_no = msm.order_no
where 1=1 and mps.sales_order_code = #{salesOrderCode} where 1=1 and mps.sales_order_code = #{salesOrderCode}
"""; """;

@ -5,7 +5,7 @@
"groupId" : "a170047f79ab4cb1b892edc5cccd823e", "groupId" : "a170047f79ab4cb1b892edc5cccd823e",
"name" : "新增", "name" : "新增",
"createTime" : null, "createTime" : null,
"updateTime" : 1729825162357, "updateTime" : 1731743100652,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -81,17 +81,38 @@ try{
create_by: createBy, create_by: createBy,
}) })
String whSql = ""
if (Objects.nonNull(marerial.warehouse)) {
whSql = "and warehouse=#{marerial.warehouse}"
} else {
whSql = "and warehouse is null"
}
// 库存扣除 // 库存扣除
var res2 = db.update(""" var res2 = db.update("""
update mini_warehouse_product set update mini_warehouse_product set
existing_inventory = existing_inventory - #{marerial.shipmentQuantity} , existing_inventory = existing_inventory - #{marerial.shipmentQuantity} ,
actual_weight = actual_weight - #{marerial.actualWeight} actual_weight = actual_weight - #{marerial.actualWeight}
where warehouse=#{marerial.warehouse} and material_code = #{marerial.materialCode} and sales_order_code = #{marerial.salesOrderCode} where order_no = #{marerial.orderNo}
""") and material_code = #{marerial.materialCode} and sales_order_code = #{marerial.salesOrderCode}
""" + whSql)
if (res2 <= 0) { if (res2 <= 0) {
tx.rollback(); tx.rollback();
exit -1, "提交失败"; exit -1, "提交失败";
} }
// 更新销售单
var res3 = db.update("""
update mini_sales_order_materials set
shipmentsed_number = shipmentsed_number + #{marerial.shipmentQuantity}
where order_no = #{marerial.orderNo}
and material_code = #{marerial.materialCode} and sales_order_code = #{marerial.salesOrderCode}
""")
print(res3)
if (res3 <= 0) {
tx.rollback();
exit -1, "提交失败";
}
}) })
res = db.table("mini_sales_shipment_materials").batchInsert(list) res = db.table("mini_sales_shipment_materials").batchInsert(list)

@ -5,7 +5,7 @@
"groupId" : "e631b317606f4246ac82585a7c1f1c5b", "groupId" : "e631b317606f4246ac82585a7c1f1c5b",
"name" : "列表", "name" : "列表",
"createTime" : null, "createTime" : null,
"updateTime" : 1728721690603, "updateTime" : 1731574285804,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -69,6 +69,7 @@ var sql = """
mso.processing_fee, mso.processing_fee,
mso.remarks, mso.remarks,
mso.create_by, mso.create_by,
mso.no_edit,
date_format(mso.create_time, '%Y-%m-%d %H:%i:%S') as create_time date_format(mso.create_time, '%Y-%m-%d %H:%i:%S') as create_time
from mini_sales_orders mso from mini_sales_orders mso
left join sys_user su on su.user_id = mso.salesperson left join sys_user su on su.user_id = mso.salesperson

@ -5,7 +5,7 @@
"groupId" : "e631b317606f4246ac82585a7c1f1c5b", "groupId" : "e631b317606f4246ac82585a7c1f1c5b",
"name" : "详情列表", "name" : "详情列表",
"createTime" : null, "createTime" : null,
"updateTime" : 1726398795041, "updateTime" : 1731574904886,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -62,9 +62,9 @@ return db.page("""
msom.unit_price, msom.unit_price,
msom.order_no, msom.order_no,
msom.status, msom.status,
mso.customer_id, mso.customer_id,
mso.price, mso.price,
mso.tax_rate mso.tax_rate
from mini_sales_order_materials msom from mini_sales_order_materials msom
left join mini_sales_orders mso on msom.sales_order_code = mso.document_number left join mini_sales_orders mso on msom.sales_order_code = mso.document_number
where 1=1 where 1=1

@ -5,7 +5,7 @@
"groupId" : "388106ae8a6c473093fbfd5473f6a755", "groupId" : "388106ae8a6c473093fbfd5473f6a755",
"name" : "新增", "name" : "新增",
"createTime" : null, "createTime" : null,
"updateTime" : 1726418533973, "updateTime" : 1731566854289,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -83,9 +83,9 @@ try{
// 更新退货数量 // 更新退货数量
res = db.update(""" res = db.update("""
update mini_sales_order_materials update mini_sales_order_materials
SET returned_number = CASE material_code SET returned_number = CASE order_no
<foreach collection="materialsList" item="item" separator=" "> <foreach collection="materialsList" item="item" separator=" ">
WHEN #{item.materialCode} THEN returned_number + #{item.returnQuantity} WHEN #{item.orderNo} THEN returned_number + #{item.returnQuantity}
</foreach> </foreach>
ELSE returned_number ELSE returned_number
END END
@ -104,6 +104,7 @@ try{
sales_return_code: orderInfo.documentNumber, sales_return_code: orderInfo.documentNumber,
material_code: marerial.materialCode, material_code: marerial.materialCode,
material_name: marerial.materialName, material_name: marerial.materialName,
order_no: marerial.orderNo,
profile_model: marerial.profileModel, profile_model: marerial.profileModel,
weight: marerial.weight, weight: marerial.weight,
specification: marerial.specification, specification: marerial.specification,

@ -5,7 +5,7 @@
"groupId" : "c3fc8c12916e40319e19fc434a708a83", "groupId" : "c3fc8c12916e40319e19fc434a708a83",
"name" : "公共sql", "name" : "公共sql",
"createTime" : null, "createTime" : null,
"updateTime" : 1728704818002, "updateTime" : 1731567002826,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,

Loading…
Cancel
Save