This commit is contained in:
2022-07-13 10:42:00 +08:00
13 changed files with 384 additions and 84 deletions

View File

@@ -143,6 +143,7 @@ public class WorkTaskServiceImpl implements WorkTaskService {
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getNickName();
String now = DateUtil.now();
WQLObject em_bi_deviceinfo = WQLObject.getWQLObject("em_bi_deviceinfo");
WQLObject PDM_BI_WorkOrder = WQLObject.getWQLObject("PDM_BI_WorkOrder"); // 工艺路线主表
WQLObject mstTab = WQLObject.getWQLObject("PDM_BI_WorkTask"); // 工艺路线主表
WQLObject PDM_BI_WorkTaskJob = WQLObject.getWQLObject("PDM_BI_WorkTaskJob"); // 工艺路线主表
@@ -161,6 +162,19 @@ public class WorkTaskServiceImpl implements WorkTaskService {
if (StrUtil.isEmpty(device_id)) {
throw new BadRequestException(jo.getString("worktask_code") + "当前记录未指定设备!");
}
String workprocedure_code = jsonMst.getString("workprocedure_code");
if("GX002".contains(workprocedure_code)){
JSONArray others = mstTab.query("worktask_id<>'"+worktask_id+"' and device_id='"+device_id+"' and status in('30')").getResultJSONArray(0);
if(others.size()>0){
throw new BadRequestException(jo.getString("worktask_code") + "指定设备有其它已开始生产但未完成任务!");
}
}
JSONObject device = em_bi_deviceinfo.query("is_delete='0' and device_id='"+device_id+"'").uniqueResult(0);
if(!workprocedure_code.equals(device.getString("workprocedure_code"))){
throw new BadRequestException(jo.getString("worktask_code") + "指定设备所属工序与当前工序任务不一致!");
}
//更新任务
HashMap<String, String> map = new HashMap<>();
map.put("status", "30");

View File

@@ -3653,6 +3653,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
@Override
public void autoAll(JSONObject map) {
WQLObject MD_ME_ProductMaterialExt = WQLObject.getWQLObject("MD_ME_ProducMaterialExt");
WQLObject pdm_bi_workprocedureparaproduct = WQLObject.getWQLObject("pdm_bi_workprocedureparaproduct");
WQLObject md_me_materialbase = WQLObject.getWQLObject("md_me_materialbase");
WQLObject PDM_BI_WorkOrder = WQLObject.getWQLObject("PDM_BI_WorkOrder");
JSONArray rows = map.getJSONArray("rows");
@@ -3665,14 +3666,21 @@ public class AutoformulaServiceImpl implements AutoformulaService {
if(workorder == null){
throw new BadRequestException("当前工令信息查询失败!");
}
JSONObject result = new JSONObject();
if("20".equals(workorder.getString("status"))){
JSONObject material = MD_ME_ProductMaterialExt.query("material_id ='"+material_id+"'").uniqueResult(0);
if(material == null ){
throw new BadRequestException("当前成品查询不到成品物料扩展信息!");
}
JSONObject materPa = pdm_bi_workprocedureparaproduct.query("para_code ='QM008' and workprocedure_code='GX002' and material_id ='"+material_id+"'").uniqueResult(0);
if(materPa == null ){
throw new BadRequestException("当前成品查询不到球磨工艺参数球磨时间!");
}
JSONObject mater = md_me_materialbase.query("material_id ='"+material_id+"'").uniqueResult(0);
workorder.put("formula_type","01");
workorder.put("ball_time",materPa.getDouble("value"));
workorder.put("waste_limit_down","0");
workorder.put("waste_limit_up","0");
workorder.put("c_balance",material.getString("c_balance"));

View File

@@ -500,15 +500,28 @@ public class FormulaServiceImpl implements FormulaService {
JSONObject json98jj = paraTab.query("material_id = '" + material_id + "' and para_code = 'QM001'").uniqueResult(0);
JSONObject json92jj = paraTab.query("material_id = '" + material_id + "' and para_code = 'QM002'").uniqueResult(0);
// 生成二维码
String create_time = jsonWork.getString("create_time");
BarcodeFormat qrCode = BarcodeFormat.QR_CODE;
BufferedImage imageCode = QrCodeUtil.generate(jsonWork.getString("workorder_id")+"#"+jsonMater.getString("ext_id")+"#"+jsonWork.getString("pcsn")+"#"+jsonWork.getString("workorder_qty")+"#"+create_time.substring(0,10), qrCode, 60, 60);
Workbook workbook = new Workbook();
// 获取模板地址
String template = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("EXCEL_PATH").getValue();
String code_template = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("CODE_EXCEL_PATH").getValue();
workbook.loadFromFile(template);
//获取第一张工作表并将二维码流put进去
Worksheet worksheet = workbook.getWorksheets().get(0);
worksheet.getPictures().add(1,1,imageCode);
workbook.saveToFile(code_template);
// 设置文件名和防止乱码现象
String fileName = URLEncoder.encode(jsonMater.getString("material_code")+"---"+jsonMst.getString("pcsn"), "UTF-8");
response.setHeader("Content-Disposition", "attachment; filename*=UTf-8''"+fileName+".xlsx");
// 获取输出流
ServletOutputStream outputStream = response.getOutputStream();
String template = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("EXCEL_PATH").getValue();
// String template = "D:\\work\\工艺控制卡模板.xlsx";
// 创建模板工作簿
ExcelWriter workBook = EasyExcel.write(outputStream, DataDto.class).withTemplate(template).build();
ExcelWriter workBook = EasyExcel.write(outputStream, DataDto.class).withTemplate(code_template).build();
// 获取第一个sheet
WriteSheet sheet = EasyExcel.writerSheet().build();
@@ -569,31 +582,26 @@ public class FormulaServiceImpl implements FormulaService {
}
// 系列设备
JSONObject jsonWorkTask_QM = workTaskTab.query("workorder_id = '" + jsonWork.getString("workorder_id") + "' and workprocedure_code = 'GX002'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonWorkTask_QM)) {
HashMap<String, String> map1 = new HashMap<>();
map1.put("flag", "3");
map1.put("product_series_id", jsonWorkTask_QM.getString("product_series_id"));
map1.put("workprocedure_id", jsonWorkTask_QM.getString("workprocedure_id"));
JSONObject jsonDevice1 = WQL.getWO("QPF_POINTCARD01").addParamMap(map1).process().uniqueResult(0);
map1.put("flag", "4");
JSONObject jsonDevice2= WQL.getWO("QPF_POINTCARD01").addParamMap(map1).process().uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonDevice1) && ObjectUtil.isNotEmpty(jsonDevice2)) {
String device_code_1 = jsonDevice1.getString("device_code").substring(4, 6);
String device_code_2 = jsonDevice2.getString("device_code").substring(4, 6);
oneMap.put("device1", device_code_1 + "-" + device_code_2);
}
HashMap<String, String> map1 = new HashMap<>();
map1.put("flag", "3");
map1.put("product_series_id", jsonMst.getString("product_series_id"));
map1.put("workprocedure_id", "1472449856613257216");
JSONObject jsonDevice1 = WQL.getWO("QPF_POINTCARD01").addParamMap(map1).process().uniqueResult(0);
map1.put("flag", "4");
JSONObject jsonDevice2= WQL.getWO("QPF_POINTCARD01").addParamMap(map1).process().uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonDevice1) && ObjectUtil.isNotEmpty(jsonDevice2)) {
String device_code_1 = jsonDevice1.getString("device_code").substring(4, 6);
String device_code_2 = jsonDevice2.getString("device_code").substring(4, 6);
oneMap.put("device1", device_code_1 + "-" + device_code_2);
}
JSONObject jsonWorkTask_PW = workTaskTab.query("workorder_id = '" + jsonWork.getString("workorder_id") + "' and workprocedure_code = 'GX003'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonWorkTask_PW)) {
HashMap<String, String> map2 = new HashMap<>();
map2.put("flag", "5");
map2.put("product_series_id", jsonWorkTask_PW.getString("product_series_id"));
map2.put("workprocedure_id", jsonWorkTask_PW.getString("workprocedure_id"));
JSONObject jsonDevice3= WQL.getWO("QPF_POINTCARD01").addParamMap(map2).process().uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonDevice3)) oneMap.put("device2",jsonDevice3.getString("device_name"));
}
HashMap<String, String> map2 = new HashMap<>();
map2.put("flag", "5");
map2.put("product_series_id", jsonMst.getString("product_series_id"));
map2.put("workprocedure_id", "1472449923327856640");
JSONObject jsonDevice3= WQL.getWO("QPF_POINTCARD01").addParamMap(map2).process().uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonDevice3)) oneMap.put("device2",jsonDevice3.getString("device_name"));
// 球磨
oneMap.put("ball_speed", jsonMaterExt.getString("ball_speed"));
@@ -797,9 +805,10 @@ public class FormulaServiceImpl implements FormulaService {
//设置相关打印选项
Paper paper = pageFormat.getPaper();
// paper.setImageableArea(0, 0, pageFormat.getWidth(), pageFormat.getHeight());
paper.setSize(1240,1754);
paper.setImageableArea(0, 0, 1240, 1754);
paper.setImageableArea(0, 0, pageFormat.getWidth(), pageFormat.getHeight());
// paper.setSize(1240,1754);
paper.setSize(595,842);
// paper.setImageableArea(0, 0, 1240, 1754);
pageFormat.setPaper(paper);
printerJob.setCopies(1);
printerJob.setPrintable(workbook, pageFormat);

View File

@@ -117,6 +117,7 @@ public class ProductmaterialsetServiceImpl implements ProductmaterialsetService
setJson.put("set_material_id", (String) json.getString("material_id"));
setJson.put("set_prior_level", (String) json.getString("set_prior_level"));
setJson.put("is_calculate_forming", json.getString("is_calculate_forming"));
setJson.put("add_rate", json.getString("add_rate"));
setTab.insert(setJson);
}
} else {
@@ -141,6 +142,7 @@ public class ProductmaterialsetServiceImpl implements ProductmaterialsetService
setJson.put("set_material_id", (String) json.getString("material_id"));
setJson.put("set_prior_level", (String) json.getString("set_prior_level"));
setJson.put("is_calculate_forming", json.getString("is_calculate_forming"));
setJson.put("add_rate", json.getString("add_rate"));
setTab.insert(setJson);
}
}

View File

@@ -99,6 +99,7 @@
mset.set_type,
mset.set_prior_level,
mset.is_calculate_forming,
mset.add_rate,
c.class_name,
ext.old_mark
FROM

View File

@@ -89,6 +89,9 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
if (StrUtil.isNotEmpty(map.get("material_code"))) {
map.put("material_code", "%" + map.get("material_code") + "%");
}
if (StrUtil.isNotEmpty(map.get("username"))) {
map.put("username", "%" + map.get("username") + "%");
}
if (StrUtil.isNotEmpty(map.get("pcsn"))) {
map.put("pcsn", "%" + map.get("pcsn") + "%");
}
@@ -100,6 +103,17 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
if (StrUtil.isNotEmpty(end_time)) {
map.put("end_time", end_time.substring(0,10)+" 23:59:59");
}
String source_bill_code = map.get("source_bill_code");
if (StrUtil.isNotEmpty(source_bill_code)) {
StringBuilder sb = new StringBuilder();
String[] strs = source_bill_code.split(",");
for(int i=0;i<strs.length;i++){
sb.append(",'" + strs[i] + "'");
}
String str = sb.toString();
str = "(" + str.substring(1) + ")";
map.put("source_bill_code", str);
}
JSONObject jo = WQL.getWO("QST_IVT_CHECKOUTBILL").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "iosdtl2.material_id");
return jo;
}

View File

@@ -16,7 +16,7 @@
输入.flag TYPEAS s_string
输入.bill_status TYPEAS s_string
输入.bill_code TYPEAS s_string
输入.source_bill_code TYPEAS s_string
输入.source_bill_code TYPEAS f_string
输入.username TYPEAS s_string
输入.create_mode TYPEAS s_string
输入.bill_type TYPEAS s_string
@@ -632,21 +632,22 @@
ST_IVT_IOStorInvDtl iosdtl
LEFT JOIN md_me_materialbase mb ON mb.material_id = iosdtl.material_id
LEFT JOIN ST_IVT_IOStorInv ios ON ios.iostorinv_id = iosdtl.iostorinv_id
LEFT JOIN sys_user user ON ios.input_optid = user.user_id
WHERE
1 = 1
AND ios.is_delete = '0'
AND ios.bill_type in ('010301','010302')
OPTION 输入.remark <> ""
(mb.material_code like 输入.remark or mb.material_name like 输入.remark)
OPTION 输入.material_code <> ""
(mb.material_code like 输入.material_code or mb.material_name like 输入.material_code)
ENDOPTION
OPTION 输入.username <> ""
(ios.input_optid = 输入.username or ios.input_optname = 输入.username)
(user.username like 输入.username or ios.input_optname like 输入.username)
ENDOPTION
OPTION 输入.pcsn <> ""
iosdtl.pcsn like 输入.pcsn
ENDOPTION
OPTION 输入.source_bill_code <> ""
iosdtl.source_bill_code = 输入.source_bill_code
iosdtl.source_bill_code in 输入.source_bill_code
ENDOPTION
OPTION 输入.begin_time <> ""
ios.biz_date >= 输入.begin_time