20241116更新

main
lcode 1 week ago
parent 7a20f97b92
commit dcf12fe671

@ -1,26 +1,18 @@
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.SignInterceptor;
import com.currency.appengine.handler.CustomMethodArgumentResolver;
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.Configuration;
import org.springframework.core.Ordered;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.*;
import java.util.List;
@Configuration
@EnableWebMvc
public class WebMvcConfig implements WebMvcConfigurer {
/**
* Interceptor verification token
*
@ -36,15 +28,9 @@ public class WebMvcConfig implements WebMvcConfigurer {
return new DevInterceptor();
}
@Bean
public SignInterceptor signInterceptor() {
return new SignInterceptor();
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(GlobalInterceptor()).addPathPatterns("/**");
registry.addInterceptor(signInterceptor()).addPathPatterns("/open/**");//只拦截open前缀的接口
registry.addInterceptor(DevInterceptor()).addPathPatterns("/swagger-ui.html").addPathPatterns("/magic/**");
}
@ -62,8 +48,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
.allowedOriginPatterns("*")
.allowCredentials(true)
.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(
"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.LineCaptcha;
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.service.system.CustomerService;
import com.currency.appengine.service.system.SupplierService;
import com.currency.appengine.service.system.SysMenuService;
import com.currency.appengine.service.system.SysParamService;
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.Result;
import com.currency.appengine.utils.StringUtil;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
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;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @date 2021/07/25
@ -37,7 +29,6 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/sys/authority")
public class SystemController {
@Autowired
SysUserService sysUserService;
@Autowired
@ -46,10 +37,6 @@ public class SystemController {
SysRoleService sysRoleService;
@Autowired
SysParamService sysParamService;
@Autowired
CustomerService customerService;
@Autowired
SupplierService supplierService;
/*
*
@ -77,7 +64,6 @@ public class SystemController {
/**
*
*
* @param params
* @return
*/
@ -178,7 +164,6 @@ public class SystemController {
/**
*
*
* @return
*/
@GetMapping("/role/list/all")
@ -250,7 +235,6 @@ public class SystemController {
/**
*
*
* @return
*/
@GetMapping("/menu/list/all")
@ -336,25 +320,4 @@ public class SystemController {
public Result 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) ");
Map<String, String> headers = HttpUtil.getHeadersInfo(request);
String token = headers.get("authorization");
String token = headers.get("authorization");;
if (token == null || token.isEmpty()) {
HttpUtil.returnJson(response, JsonUtil.generate(Result.fail(-2, "result.not_token")));
log.info(">>>>>>>check token fail");

@ -25,6 +25,7 @@ public class CommonServices {
/**
*
*
* @param type
* @param data
* @return
@ -38,7 +39,8 @@ public class CommonServices {
grantTypeMap.put("OrderNumber", params -> orderNumber(params)); // 订单编号
grantTypeMap.put("ProductionPlan", params -> productionPlan(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)); // 采购编号
Function<Map<String, Object>, String> result = grantTypeMap.get(type);
@ -52,6 +54,7 @@ public class CommonServices {
/**
* C+5
* mini_customer_info
*
* @param params
* @return
*/
@ -77,6 +80,7 @@ public class CommonServices {
/**
* V+5
*
* @param params
* @return
*/
@ -103,6 +107,7 @@ public class CommonServices {
/**
* ++3SW20240929-001SW20240929-002SW20240929-003..)
*
* @param params
* @return
*/
@ -121,6 +126,7 @@ public class CommonServices {
/**
* +0010100102
*
* @param params
* @return
*/
@ -138,6 +144,7 @@ public class CommonServices {
/**
* :P+3
*
* @param params
* @return
*/
@ -154,6 +161,7 @@ public class CommonServices {
/**
* JY+3
*
* @param params
* @return
*/
@ -170,6 +178,7 @@ public class CommonServices {
/**
* BG++3
*
* @param params
* @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++
*
* @param params
* @return
*/
@ -216,6 +264,7 @@ public class CommonServices {
}
return pinyinFirstLetters.toString();
}
public static void main(String[] arg) {
// int sequenceNumber = 123456; // 假设这是你的序号
// 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_yyyyMMdd = new SimpleDateFormat("yyyyMMdd");
private final static SimpleDateFormat FORMAT_yyMMdd = new SimpleDateFormat("yyMMdd");
/**
* yyyy-MM-dd HH:mm:ss
* @param timeStr
@ -90,6 +91,10 @@ public class DateUtil {
return FORMAT_yyyyMMdd.format(new Date());
}
public static String getYyMMdd() {
return FORMAT_yyMMdd.format(new Date());
}
/**
*
* @param format yyyy-MM-dd HH:mm:ss

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

@ -5,7 +5,7 @@
"groupId" : "4aa6b5de02c244e2981c22bf5a95394d",
"name" : "新增",
"createTime" : null,
"updateTime" : 1729160184169,
"updateTime" : 1731737780581,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@ -73,6 +73,7 @@ try{
actual_weight: marerial.actualWeight,
unstocked_quantity: marerial.unstockedQuantity,
stocked_quantity: marerial.stockedQuantity,
order_no: marerial.orderNo,
create_by: createBy
})
})
@ -162,29 +163,54 @@ try{
ON DUPLICATE KEY UPDATE
packing_quantity = CASE
<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>
ELSE packing_quantity
END,
existing_inventory = CASE
<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>
ELSE existing_inventory
END,
actual_weight = CASE
<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>
ELSE actual_weight
END
""")
if (res > 0) {
// 更新报工中已入库的数量
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();
exit -1, "提交失败";
}catch(e){

@ -5,7 +5,7 @@
"groupId" : "4aa6b5de02c244e2981c22bf5a95394d",
"name" : "详情",
"createTime" : null,
"updateTime" : 1729153406281,
"updateTime" : 1731567422340,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@ -52,7 +52,7 @@ return {
${warehouseProductMaterial}
from mini_product_receipt mpr
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
and mpr.document_number = #{documentNumber}
"""),

@ -5,7 +5,7 @@
"groupId" : "06bb1cef20924ed8887b1c3ae8a91d3a",
"name" : "修改",
"createTime" : null,
"updateTime" : 1729144854213,
"updateTime" : 1731737082705,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@ -25,10 +25,10 @@
"expression" : 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" : [ {
"name" : "authorization",
"value" : "5E34C0D7EA601026B93C26119C7E1AD59CF35D76F0DCA5272366FC6A87E41372412D8F4473A6A7BD5E5C1D4E94AEFD40",
"value" : "5E34C0D7EA601026B93C26119C7E1AD5304936225AC6AC0DD5E00182C1DF3624BE38DB349BDC91696CBC04B5F9AB5B53",
"description" : "登录token",
"required" : false,
"dataType" : "String",
@ -40,12 +40,14 @@
"children" : null
} ],
"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,
"requestBodyDefinition" : null,
"responseBodyDefinition" : null
}
================================
import 'commonServices' as CommonServices
String id = body.id;
String productionNumber = body.productionNumber;
String productionWeight = body.productionWeight;
@ -53,10 +55,23 @@ String scrapNumber = body.scrapNumber;
String scrapReason = body.scrapReason;
String frameNumber = body.frameNumber;
String nextProcess = body.nextProcess;
String netReceipts = body.netReceipts;
String isCompleted = body.isCompleted;
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()
try {
@ -68,6 +83,7 @@ try {
scrap_number: scrapNumber,
scrap_reason: scrapReason,
frame_number: frameNumber,
net_receipts: netReceipts,
next_process: nextProcess,
is_completed: isCompleted,
remarks: remarks,
@ -76,16 +92,40 @@ try {
tx.rollback();
exit - 1, "失败"
}
if ((Objects.isNull(nextProcess) || nextProcess == "")) {
// if ((Objects.isNull(nextProcess) || nextProcess == "")) {
// if (isCompleted == 1) {
// // 完成更新
// }
// tx.commit()
// return;
// }
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()
return;
}
// 自动生成编码
Map codeParams = new HashMap();
codeParams.put("currentProcess", nextProcess);
map.reportNumber = CommonServices.getCode("ProductionOrderNumberSub", codeParams)
// 插入新工序
res = db.table("mini_process_report").insert({
schedule_number: map.scheduleNumber,
@ -99,8 +139,16 @@ try {
source_number: productionNumber,
net_receipts: productionNumber,
sales_order_code: map.salesOrderCode,
order_no: map.orderNo,
material_code: map.materialCode,
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) {
@ -111,6 +159,7 @@ try {
exit - 1, "失败"
return;
} catch (e) {
print(e.getMessage())
tx.rollback()
exit - 1, "失败"
}

@ -5,7 +5,7 @@
"groupId" : "06bb1cef20924ed8887b1c3ae8a91d3a",
"name" : "列表",
"createTime" : null,
"updateTime" : 1730109402968,
"updateTime" : 1731729532436,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@ -57,10 +57,13 @@ report_date
String salesOrderCode = body.salesOrderCode;
String scheduleNumber = body.scheduleNumber;
String reportNumber = body.reportNumber;
String currentProcess = body.currentProcess;
String currentProcess = body.currentProcess; // 当前工序
String reportDate = body.reportDate;
String profileModel = body.profileModel;
// 产品代码 型材型号 物料名称 规格型号 壁厚 米重
// 订单长度M 表面方式 订单总数 排产长度(m) 排产支数 排产日期 锯切方式 交货日期
var sql = """
select
mpr.id,
@ -79,10 +82,33 @@ mpr.frame_number,
mpr.is_completed,
mpr.sales_order_code,
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
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
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
-- and next_process is null
?{salesOrderCode != null and salesOrderCode != '', and mpr.sales_order_code like concat('%', #{salesOrderCode}, '%')}

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

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

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

@ -5,7 +5,7 @@
"groupId" : "f4b3acf704cf4db29258ba70e24f8fc5",
"name" : "新增",
"createTime" : null,
"updateTime" : 1728726723475,
"updateTime" : 1731651357563,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@ -76,33 +76,12 @@ try{
if (res > 0) {
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 list2 = new ArrayList();
materialsList.map(marerial => {
list.add({
schedule_number: orderInfo.scheduleNumber,
sales_order_code: marerial.salesOrderCode,
order_no: marerial.orderNo,
material_code: marerial.materialCode,
production_length: marerial.productionLength,
production_pieces: marerial.productionPieces,
@ -114,6 +93,29 @@ try{
res = db.table("mini_extrusion_schedule_detail").batchInsert(list)
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(); // 提交事务
exit 0, "执行成功", null;
}

@ -5,7 +5,7 @@
"groupId" : "f4b3acf704cf4db29258ba70e24f8fc5",
"name" : "详情",
"createTime" : null,
"updateTime" : 1728728158049,
"updateTime" : 1731567258141,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@ -59,7 +59,7 @@ return {
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
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}
"""),

@ -5,7 +5,7 @@
"groupId" : "f4b3acf704cf4db29258ba70e24f8fc5",
"name" : "详情列表",
"createTime" : null,
"updateTime" : 1730452017745,
"updateTime" : 1731567261894,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@ -557,7 +557,7 @@ return db.page("""
from
mini_extrusion_schedule_detail mesd
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
?{scheduleNumber != null and scheduleNumber != '', and mesd.schedule_number like concat('%', #{scheduleNumber}, '%')}
?{salesOrderCode != null and salesOrderCode != '', and msm.sales_order_code like concat('%', #{salesOrderCode}, '%')}

@ -5,7 +5,7 @@
"groupId" : "06d35cc5db5f4e6681262a1648c871c3",
"name" : "修改",
"createTime" : null,
"updateTime" : 1726362872013,
"updateTime" : 1731567452397,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@ -50,10 +50,11 @@ String salesOrderCode = body.salesOrderCode;
String materialCode = body.materialCode;
String plannedPieces = body.plannedPieces;
String remarks = body.remarks;
String orderNo = body.orderNo;
return db.update("""
update mini_production_schedule set
planned_pieces=#{plannedPieces},
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",
"name" : "列表",
"createTime" : null,
"updateTime" : 1730451538439,
"updateTime" : 1731643614960,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@ -165,6 +165,8 @@ String deliveryDate = body["deliveryDate"];
String customerName = body["customerName"];
String orderNo = body["orderNo"];
String orderStatus = body["orderStatus"]; // 订单状态
String salesOrdeSelect = sql("salesOrder")
String sql = """
select
@ -179,6 +181,7 @@ String sql = """
mso.pricing_date,
mso.tax_rate,
mso.processing_fee,
mps.status as plan_status,
${salesOrdeSelect}
from
mini_production_schedule mps
@ -186,7 +189,7 @@ String sql = """
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
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
?{salesOrderCode != null and salesOrderCode != "", and mps.sales_order_code = #{salesOrderCode}}
?{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}, '%')}
?{deliveryDate != null and deliveryDate != '', and mso.delivery_date = #{deliveryDate}}
""";
// ?{orderStatus != null and orderStatus != '', and mps.status = #{orderStatus}}
return db.page(sql);

@ -5,7 +5,7 @@
"groupId" : "06d35cc5db5f4e6681262a1648c871c3",
"name" : "新增",
"createTime" : null,
"updateTime" : 1728724750705,
"updateTime" : 1731575808607,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@ -48,8 +48,30 @@
================================
import 'commonServices' as CommonServices
List selection = body.selection;
String type = body["type"];
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;
if (Objects.isNull(selection) || selection.size() <= 0) {
exit - 1, "数据为空"
@ -73,13 +95,14 @@ try{
insert into mini_production_schedule(
document_number,
sales_order_code,
order_no,
material_code,
planned_pieces,
remarks,
create_by
) values
<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>
""")
if (res > 0) {
@ -89,9 +112,9 @@ try{
var res2 = db.update("""
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=",">
(#{orderInfo.documentNumber}, #{item.materialCode})
(#{orderInfo.documentNumber}, #{item.orderNo})
</foreach>
)
""")

@ -5,7 +5,7 @@
"groupId" : "06d35cc5db5f4e6681262a1648c871c3",
"name" : "详情",
"createTime" : null,
"updateTime" : 1728721582011,
"updateTime" : 1731567386509,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@ -35,7 +35,7 @@ String sql = """
from
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
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}
""";

@ -5,7 +5,7 @@
"groupId" : "a170047f79ab4cb1b892edc5cccd823e",
"name" : "新增",
"createTime" : null,
"updateTime" : 1729825162357,
"updateTime" : 1731743100652,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@ -81,17 +81,38 @@ try{
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("""
update mini_warehouse_product set
existing_inventory = existing_inventory - #{marerial.shipmentQuantity} ,
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) {
tx.rollback();
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)

@ -5,7 +5,7 @@
"groupId" : "e631b317606f4246ac82585a7c1f1c5b",
"name" : "列表",
"createTime" : null,
"updateTime" : 1728721690603,
"updateTime" : 1731574285804,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@ -69,6 +69,7 @@ var sql = """
mso.processing_fee,
mso.remarks,
mso.create_by,
mso.no_edit,
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

@ -5,7 +5,7 @@
"groupId" : "e631b317606f4246ac82585a7c1f1c5b",
"name" : "详情列表",
"createTime" : null,
"updateTime" : 1726398795041,
"updateTime" : 1731574904886,
"lock" : null,
"createBy" : null,
"updateBy" : null,

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

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

Loading…
Cancel
Save