This commit is contained in:
2022-07-09 23:15:02 +08:00
21 changed files with 424 additions and 164 deletions

View File

@@ -411,6 +411,10 @@ public class HandPFOutIvtServiceImpl implements HandPFOutIvtService {
public Map<String, Object> confirmOutStore2(Map<String, String> jsonObject) {
String input_optid = MapUtil.getStr(jsonObject, "input_optid");
String input_optname = MapUtil.getStr(jsonObject, "input_optname");
String source_billdtl_id = MapUtil.getStr(jsonObject, "source_billdtl_id");
String source_bill_type = MapUtil.getStr(jsonObject, "source_bill_type");
String source_bill_code = MapUtil.getStr(jsonObject, "source_bill_code");
String source_bill_table = MapUtil.getStr(jsonObject, "source_bill_table");
Long currentUserId = SecurityUtils.getCurrentUserId();
UserDto userDto = userService.findById(currentUserId);
// 仓位属性表【ST_IVT_StructAttr】
@@ -569,6 +573,7 @@ public class HandPFOutIvtServiceImpl implements HandPFOutIvtService {
invrow.put("syscompanyid", userDto.getDept().getId());
invrow.put("is_delete", "0");
invrow.put("is_upload", "0");
//明细
invdtl.put("iostorinvdtl_id", iostorinvdtl_id);
@@ -586,6 +591,10 @@ public class HandPFOutIvtServiceImpl implements HandPFOutIvtService {
invdtl.put("real_qty", out_qty);
invdtl.put("assign_qty", out_qty);
invdtl.put("unassign_qty", "0");
invdtl.put("source_billdtl_id", source_billdtl_id);
invdtl.put("source_bill_type", source_bill_type);
invdtl.put("source_bill_code", source_bill_code);
invdtl.put("source_bill_table", source_bill_table);
//分配
disjo.put("iostorinvdis_id", iostorinvdis_id);
disjo.put("iostorinvdtl_id", iostorinvdtl_id);
@@ -843,9 +852,8 @@ public class HandPFOutIvtServiceImpl implements HandPFOutIvtService {
AbstractAcsTask intask = new InTask();
//调用ACS接受任务接口
WQLObject taskTable = WQLObject.getWQLObject("sch_base_task");
JSONArray taskObjja = taskTable.query("vehicle_code='" + storagevehicle_code + "' ").getResultJSONArray(0);
JSONObject taskObj = taskTable.query("vehicle_code='" + storagevehicle_code + "' and task_status='01' is_delete = '0'").uniqueResult(0);
JSONObject taskObj = taskTable.query("vehicle_code='" + storagevehicle_code + "' and task_status='01' and is_delete ='0'").uniqueResult(0);
if (ObjectUtil.isEmpty(taskObj)) {
throw new PdaRequestException("托盘为【'" + storagevehicle_code + "'】指令未找到");
}

View File

@@ -196,6 +196,8 @@ public class MaterialParametersServiceImpl implements MaterialParametersService
jsonProduc.put("is_need_move", map.get("is_need_move"));
jsonProduc.put("net_rate", map.get("net_rate"));
jsonProduc.put("technology_code", map.get("technology_code"));
jsonProduc.put("ball_rate", map.get("ball_rate"));
jsonProduc.put("liquid_rate", map.get("liquid_rate"));
producTab.insert(jsonProduc);
} else {
json.put("standard_weight", map.get("standard_weight"));
@@ -217,6 +219,8 @@ public class MaterialParametersServiceImpl implements MaterialParametersService
json.put("is_need_move", map.get("is_need_move"));
json.put("net_rate", map.get("net_rate"));
json.put("technology_code", map.get("technology_code"));
json.put("ball_rate", map.get("ball_rate"));
json.put("liquid_rate", map.get("liquid_rate"));
producTab.update(json);
}
JSONObject jsonMater = materTab.query("material_id = '" + material_id + "' and is_delete = '0'").uniqueResult(0);

View File

@@ -77,6 +77,8 @@
p.is_need_move AS product_is_need_move,
p.net_rate,
p.technology_code,
p.ball_rate,
p.liquid_rate,
m.is_used,
m.update_optname,
m.update_time,

View File

@@ -4,10 +4,12 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.nl.exception.BadRequestException;
import org.nl.utils.SecurityUtils;
import org.nl.wms.basedata.master.constant.MaterOptTypeEnum;
import org.nl.wms.basedata.master.service.ClassstandardService;
@@ -182,9 +184,19 @@ public class ProductProcessParamServiceImpl implements ProductProcessParamServic
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getNickName();
String now = DateUtil.now();
String jx1 = "";
String jx2 = "";
for (int i = 0; i < dtlArr.size(); i++) {
JSONObject jsonObject = dtlArr.getJSONObject(i);
String para_code = jsonObject.getString("para_code");
if (StrUtil.equals(para_code, "QM001")) {
jx1 = jsonObject.getString("value");
}
if (StrUtil.equals(para_code, "QM002")) {
jx2 = jsonObject.getString("value");
}
jsonObject.put("paradtl_id", IdUtil.getSnowflake(1, 1).nextId());
jsonObject.put("material_id", materialDto.getMaterial_id());
jsonObject.put("create_id", currentUserId);
@@ -194,8 +206,16 @@ public class ProductProcessParamServiceImpl implements ProductProcessParamServic
jsonObject.put("update_optname", nickName);
jsonObject.put("update_time", now);
wppTab.insert(jsonObject);
}
if (ObjectUtil.isNotEmpty(jx1) && ObjectUtil.isNotEmpty(jx2)) {
if (StrUtil.equals(jx1, "0") && StrUtil.equals(jx2, "0")) {
throw new BadRequestException("98酒精和92酒精不能同时为0");
}
if (StrUtil.equals(jx1, "1") && StrUtil.equals(jx2, "1")) {
throw new BadRequestException("98酒精和92酒精不能同时为1");
}
}
}
@Override

View File

@@ -520,7 +520,7 @@ public class WorkTaskServiceImpl implements WorkTaskService {
PDM_BI_ProcedureOfflineBucketRecord.insert(OfflineFlow);
JSONObject printJson = new JSONObject();
printJson.put("bucketunique", IdUtil.getSnowflake(1, 1).nextId());
printJson.put("bucketunique", jsonBuc.getString("bucketunique"));
printJson.put("material_id", whereJson.getString("ext_id"));
printJson.put("material_code", whereJson.getString("material_code"));
printJson.put("material_name", whereJson.getString("material_name"));

View File

@@ -696,26 +696,27 @@ public class AutoformulaServiceImpl implements AutoformulaService {
if(C<0){
flag = false;
}else if(C>=0){
JSONObject C_weight = new JSONObject();
C_weight.put("formula_qty",C);
//钨分类id
C_weight.put("material_id","1503644362788179968");
C_weight.put("material_name","碳粉");
C_weight.put("material_code","09030104");
C_weight.put("material_type","02");
C_weight.put("is_need_move","0");
C_weight.put("is_need_manage","1");
C_weight.put("is_tan","100");
C_weight.put("is_rf_xl","1");
C_weight.put("ivt_level","01");
C_weight.put("is_active","1");
C_weight.put("quality_scode","01");
cw_list.add(C_weight);
//更新碳化钨配粉重量
double bom_ivt_qty = X22p-C;
if(bom_ivt_qty<0){
flag = false;
}else{
JSONObject C_weight = new JSONObject();
C_weight.put("formula_qty",C);
//钨分类id
C_weight.put("material_id","1503644362788179968");
C_weight.put("material_name","碳粉");
C_weight.put("material_code","09030104");
C_weight.put("material_type","02");
C_weight.put("is_need_move","0");
C_weight.put("is_need_manage","1");
C_weight.put("is_tan","100");
C_weight.put("is_rf_xl","1");
C_weight.put("ivt_level","01");
C_weight.put("is_active","1");
C_weight.put("quality_scode","01");
cw_list.add(C_weight);
bomdlt_Cr3C2_X22p.put("bom_ivt_qty",bom_ivt_qty);
bomdlts_plan_map.put(bomdlt_Cr3C2_X22p.getString("stockrecord_id"),bomdlt_Cr3C2_X22p);
if(bom_ivt_qty<=0){
@@ -969,25 +970,26 @@ public class AutoformulaServiceImpl implements AutoformulaService {
if(W<0){
flag = false;
}else if(W>=0){
JSONObject W_weight = new JSONObject();
W_weight.put("formula_qty",W);
//钨分类id
W_weight.put("material_id","1503644362234531840");
W_weight.put("material_name","钨粉");
W_weight.put("material_code","09030103");
W_weight.put("material_type","02");
W_weight.put("is_need_move","0");
W_weight.put("is_need_manage","1");
W_weight.put("is_rf_xl","0");
W_weight.put("ivt_level","01");
W_weight.put("is_active","1");
W_weight.put("quality_scode","01");
cw_list.add(W_weight);
//更新碳化钨配粉重量
double bom_ivt_qty = X22p-W;
if(bom_ivt_qty<0){
flag = false;
}else{
JSONObject W_weight = new JSONObject();
W_weight.put("formula_qty",W);
//钨分类id
W_weight.put("material_id","1503644362234531840");
W_weight.put("material_name","钨粉");
W_weight.put("material_code","09030103");
W_weight.put("material_type","02");
W_weight.put("is_need_move","0");
W_weight.put("is_need_manage","1");
W_weight.put("is_rf_xl","0");
W_weight.put("ivt_level","01");
W_weight.put("is_active","1");
W_weight.put("quality_scode","01");
cw_list.add(W_weight);
bomdlt_Cr3C2_X22p.put("bom_ivt_qty",bom_ivt_qty);
bomdlts_plan_map.put(bomdlt_Cr3C2_X22p.getString("stockrecord_id"),bomdlt_Cr3C2_X22p);
if(bom_ivt_qty<=0){
@@ -1584,26 +1586,28 @@ public class AutoformulaServiceImpl implements AutoformulaService {
if(C<0){
flag = false;
}else if(C>=0){
JSONObject C_weight = new JSONObject();
C_weight.put("formula_qty",C);
//钨分类id
C_weight.put("material_id","1503644362788179968");
C_weight.put("material_name","碳粉");
C_weight.put("material_code","09030104");
C_weight.put("material_type","02");
C_weight.put("is_need_move","0");
C_weight.put("is_need_manage","1");
C_weight.put("is_tan","100");
C_weight.put("is_rf_xl","1");
C_weight.put("ivt_level","01");
C_weight.put("is_active","1");
C_weight.put("quality_scode","01");
cw_list.add(C_weight);
//更新碳化钨配粉重量
double bom_ivt_qty = X22p-C;
if(bom_ivt_qty<0){
flag = false;
}else{
JSONObject C_weight = new JSONObject();
C_weight.put("formula_qty",C);
//钨分类id
C_weight.put("material_id","1503644362788179968");
C_weight.put("material_name","碳粉");
C_weight.put("material_code","09030104");
C_weight.put("material_type","02");
C_weight.put("is_need_move","0");
C_weight.put("is_need_manage","1");
C_weight.put("is_tan","100");
C_weight.put("is_rf_xl","1");
C_weight.put("ivt_level","01");
C_weight.put("is_active","1");
C_weight.put("quality_scode","01");
cw_list.add(C_weight);
bomdlt_Cr3C2_X22p.put("bom_ivt_qty",bom_ivt_qty);
bomdlts_plan_map.put(bomdlt_Cr3C2_X22p.getString("stockrecord_id"),bomdlt_Cr3C2_X22p);
if(bom_ivt_qty<=0){
@@ -1852,25 +1856,26 @@ public class AutoformulaServiceImpl implements AutoformulaService {
if(W<0){
flag = false;
}else if(W>=0){
JSONObject W_weight = new JSONObject();
W_weight.put("formula_qty",W);
//钨分类id
W_weight.put("material_id","1503644362234531840");
W_weight.put("material_name","钨粉");
W_weight.put("material_code","09030103");
W_weight.put("material_type","02");
W_weight.put("is_need_move","0");
W_weight.put("is_need_manage","1");
W_weight.put("is_rf_xl","0");
W_weight.put("ivt_level","01");
W_weight.put("is_active","1");
W_weight.put("quality_scode","01");
cw_list.add(W_weight);
//更新碳化钨配粉重量
double bom_ivt_qty = X22p-W;
if(bom_ivt_qty<0){
flag = false;
}else{
JSONObject W_weight = new JSONObject();
W_weight.put("formula_qty",W);
//钨分类id
W_weight.put("material_id","1503644362234531840");
W_weight.put("material_name","钨粉");
W_weight.put("material_code","09030103");
W_weight.put("material_type","02");
W_weight.put("is_need_move","0");
W_weight.put("is_need_manage","1");
W_weight.put("is_rf_xl","0");
W_weight.put("ivt_level","01");
W_weight.put("is_active","1");
W_weight.put("quality_scode","01");
cw_list.add(W_weight);
bomdlt_Cr3C2_X22p.put("bom_ivt_qty",bom_ivt_qty);
bomdlts_plan_map.put(bomdlt_Cr3C2_X22p.getString("stockrecord_id"),bomdlt_Cr3C2_X22p);
if(bom_ivt_qty<=0){

View File

@@ -531,6 +531,7 @@ public class FlourworkServiceImpl implements FlourworkService {
WQLObject formMstTab = WQLObject.getWQLObject("PDM_BI_Formula"); // 配方主表
WQLObject formDtlTab = WQLObject.getWQLObject("PDM_BI_FormulaDtl"); // 配方明细表
WQLObject workTab = WQLObject.getWQLObject("PDM_BI_WorkOrder"); // 工令表
WQLObject formDtlJobTab = WQLObject.getWQLObject("PDM_BI_FormulaDtlJob"); // 配方明细作业表
WQLObject formBuckeTab = WQLObject.getWQLObject("PDM_BI_FormulaBucketRecord"); // 配粉间桶记录表
@@ -554,6 +555,8 @@ public class FlourworkServiceImpl implements FlourworkService {
*/
JSONObject jsonFormDtl = formDtlTab.query("formuladtl_id = '" + jsonFormDtlJob.getString("formuladtl_id") + "'").uniqueResult(0);
JSONObject jsonFormMst = formMstTab.query("formula_id = '" + jsonFormDtl.getString("formula_id") + "'").uniqueResult(0);
JSONObject jsonWork = workTab.query("workorder_id = '" + jsonFormMst.getString("workorder_id") + "'").uniqueResult(0);
// 1.如果是
if (StrUtil.equals(jsonFormDtl.getString("is_need_move"), "1")) {
// 调用配粉出库并确认参数point_code货位storagevehicle_code载具号type配粉出库类型bucketunique桶号out_qty出库数量
@@ -570,6 +573,10 @@ public class FlourworkServiceImpl implements FlourworkService {
map.put("out_qty", jsonFormDtlJob.getString("outconfirm_qty"));
map.put("input_optid", jsonFormDtlJob.getString("create_id"));
map.put("input_optname", jsonFormDtlJob.getString("create_name"));
map.put("source_billdtl_id", jsonWork.getString("workorder_id"));
map.put("source_bill_type", jsonWork.getString("workorder_type"));
map.put("source_bill_code", jsonWork.getString("workorder_code"));
map.put("source_bill_table", "PDM_BI_WorkOrder");
handPFOutIvtService.confirmOutStore2(map);
} else {
// 2.如果不是

View File

@@ -22,8 +22,10 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.exception.BadRequestException;
import org.nl.modules.security.service.dto.JwtUserDto;
import org.nl.modules.system.service.impl.ParamServiceImpl;
import org.nl.modules.system.util.CodeUtil;
import org.nl.utils.SecurityUtils;
import org.nl.utils.SpringContextHolder;
import org.nl.wms.basedata.master.constant.MaterOptTypeEnum;
import org.nl.wms.basedata.master.service.ClassstandardService;
import org.nl.wms.basedata.master.service.MaterialbaseService;
@@ -237,6 +239,7 @@ public class FormulaServiceImpl implements FormulaService {
PDM_BI_FormulaDtl.insert(jo);
}
Formula.put("masterbucket_qty",masterbucket_qty+"");
Formula.put("ball_time",whereJson.getString("ball_time"));
Formula.put("extadd_qty",extadd_qty+"");
Formula.put("is_audit", "1");
Formula.put("audit_id",currentUserId);
@@ -473,93 +476,154 @@ public class FormulaServiceImpl implements FormulaService {
@Override
@Transactional(rollbackFor = Exception.class)
public void preview(HttpServletResponse response, Map whereJson) throws IOException {
/* String formula_id = MapUtil.getStr(whereJson, "formula_id");
String formula_id = MapUtil.getStr(whereJson, "formula_id");
WQLObject formMstTab = WQLObject.getWQLObject("PDM_BI_Formula"); // 配方主表
WQLObject formDtlTab = WQLObject.getWQLObject("PDM_BI_FormulaDtl"); // 配方明细表
WQLObject workTab = WQLObject.getWQLObject("PDM_BI_WorkOrder"); // 工令表
WQLObject deptTab = WQLObject.getWQLObject("sys_dept"); // 部门表
WQLObject storageTab = WQLObject.getWQLObject("tool_local_storage"); // 文件表
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料表
WQLObject materExtTab = WQLObject.getWQLObject("MD_ME_ProducMaterialExt"); // 成品扩展属性表
WQLObject paraTab = WQLObject.getWQLObject("PDM_BI_WorkProcedureParaProduct"); // 工艺参数表
WQLObject workTaskTab = WQLObject.getWQLObject("PDM_BI_WorkTask"); // 工令工序任务表
WQLObject classTab = WQLObject.getWQLObject("md_pb_classstandard"); // 分类表
JSONObject jsonMst = formMstTab.query("formula_id ='" + formula_id + "'").uniqueResult(0);
String material_id = jsonMst.getString("material_id");
JSONObject jsonMater = materTab.query("material_id ='" + material_id + "'").uniqueResult(0);
JSONObject jsonStor = storageTab.query("source_bill_id = '" + material_id + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonStor)) throw new BadRequestException("此物料模板不存在,请先上传模板");
JSONObject jsonWork = workTab.query("workorder_id = '" + jsonMst.getString("workorder_id") + "'").uniqueResult(0);
JSONObject jsonDept = deptTab.query("dept_id = '" + jsonWork.getString("org_id") + "'").uniqueResult(0);
JSONObject jsonMaterExt = materExtTab.query("material_id = '" + material_id + "'").uniqueResult(0);
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 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 = jsonStor.getString("path");
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();
// 获取第一个sheet
WriteSheet sheet = EasyExcel.writerSheet().build();
// 查询配方明细
ArrayList<HashMap<String,String>> data = new ArrayList<>();
JSONArray dtlArr = formDtlTab.query("formula_id ='" + formula_id + "'").getResultJSONArray(0);
for (int i = 0; i < dtlArr.size(); i++) {
JSONObject json = dtlArr.getJSONObject(i);
String material_id1 = json.getString("material_id");
// 判断明细是物料明细还是分类
JSONObject jsonClassOrMater = new JSONObject();
if (StrUtil.equals(json.getString("material_type"), "01")) {
jsonClassOrMater = materTab.query("material_id ='"+material_id1+"'").uniqueResult(0);
} else {
jsonClassOrMater = classTab.query("class_id = '"+material_id1+"'").uniqueResult(0);
}
// 判断物料是原料还是辅料
boolean is_YL = false;
boolean is_FL = false;
if (StrUtil.equals(json.getString("material_type"), "01")) {
is_YL = materialbaseService.isAlongMaterType(MaterOptTypeEnum.YL.getCode(), material_id1, null);
is_FL = materialbaseService.isAlongMaterType(MaterOptTypeEnum.FL.getCode(), material_id1, null);
} else {
String class_idStr = MaterOptTypeEnum.YL.getClass_idStr();
String class_ids = classstandardService.getAllChildIdStr(class_idStr);
if (class_ids.contains(material_id1)) {
is_YL = true;
}
String class_idStr2 = MaterOptTypeEnum.FL.getClass_idStr();
String class_ids2 = classstandardService.getAllChildIdStr(class_idStr2);
if (class_ids2.contains(material_id1)) {
is_FL = true;
}
}
String classIdsFl = classstandardService.getAllChildIdStr(MaterOptTypeEnum.FL.getClass_idStr());
// 单组填充
String planstart_time = jsonMst.getString("create_time");
if (is_YL) {
HashMap<String, String> mapYL = new HashMap<>();
if (StrUtil.equals(json.getString("material_type"), "01")) {
mapYL.put("raw_material_name",jsonClassOrMater.getString("material_name"));
} else {
mapYL.put("raw_material_name",jsonClassOrMater.getString("class_name"));
}
mapYL.put("raw_pcsn",json.getString("pcsn"));
mapYL.put("raw_weight",json.getString("formula_qty"));
data.add(mapYL);
HashMap<String, Object> oneMap = new HashMap<>();
// 工令相关
oneMap.put("material_code", jsonMater.getString("material_code"));
if (ObjectUtil.isNotEmpty(jsonDept)) oneMap.put("dept_name", jsonDept.getString("name"));
if (ObjectUtil.isNotEmpty(jsonMaterExt)) oneMap.put("old_mark", jsonMaterExt.getString("old_mark"));
oneMap.put("pcsn", jsonMst.getString("pcsn"));
oneMap.put("weight",NumberUtil.round(jsonWork.getString("workorder_qty"),3));
if (ObjectUtil.isNotEmpty(planstart_time)) {
oneMap.put("date_time", planstart_time.substring(0,10));
}
// 球磨相关
oneMap.put("ball_rate",NumberUtil.mul(jsonWork.getDoubleValue("workorder_qty"),jsonMaterExt.getDoubleValue("ball_rate")));
oneMap.put("liquid_rate",NumberUtil.mul(jsonWork.getDoubleValue("workorder_qty"),jsonMaterExt.getDoubleValue("liquid_rate")));
if (ObjectUtil.isNotEmpty(json98jj)) {
if (StrUtil.equals(json98jj.getString("value"), "1.00")) {
oneMap.put("para_name", json98jj.getString("para_name"));
}
if (is_FL) {
HashMap<String, String> mapFL = new HashMap<>();
if (StrUtil.equals(json.getString("material_type"), "01")) {
mapFL.put("fu_material_name",jsonClassOrMater.getString("material_name"));
} else {
mapFL.put("fu_material_name",jsonClassOrMater.getString("class_name"));
}
mapFL.put("fu_pcsn",json.getString("pcsn"));
mapFL.put("fu_weight",json.getString("formula_qty"));
data.add(mapFL);
}
if (ObjectUtil.isNotEmpty(json92jj)) {
if (StrUtil.equals(json92jj.getString("value"), "1.00")) {
oneMap.put("para_name", json92jj.getString("para_name"));
}
}
JSONObject jsonQM13 = paraTab.query("material_id = '" + material_id + "' and para_code = 'QM013'").uniqueResult(0);
JSONObject jsonQM14 = paraTab.query("material_id = '" + material_id + "' and para_code = 'QM014'").uniqueResult(0);
JSONObject jsonPW02 = paraTab.query("material_id = '" + material_id + "' and para_code = 'PW002'").uniqueResult(0);
JSONObject jsonPW03 = paraTab.query("material_id = '" + material_id + "' and para_code = 'PW003'").uniqueResult(0);
JSONObject jsonPW04 = paraTab.query("material_id = '" + material_id + "' and para_code = 'PW004'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonQM13)) oneMap.put("number_1", jsonQM13.getString("value"));
if (ObjectUtil.isNotEmpty(jsonQM14)) oneMap.put("number_2", jsonQM14.getString("value"));
if (ObjectUtil.isNotEmpty(jsonPW02)) {
oneMap.put("number_8", jsonPW02.getString("value"));
}
if (ObjectUtil.isNotEmpty(jsonPW03)) {
String value = jsonPW03.getString("value");
String value_1 = NumberUtil.sub(value, "100").toString();
String value_2 = NumberUtil.add(value, "100").toString();
oneMap.put("number_4", value);
oneMap.put("number_5", value_1 + "~" + value_2);
}
if (ObjectUtil.isNotEmpty(jsonPW04)) {
String value = jsonPW04.getString("value");
String value_1 = NumberUtil.sub(value, "3").toString();
String value_2 = NumberUtil.add(value, "2").toString();
String value_3 = NumberUtil.sub(value, "5").toString();
String value_4 = NumberUtil.add(value, "7").toString();
oneMap.put("number_6", value_1 + "-" + value_2);
oneMap.put("number_7", value_3 + "~" + value_4);
}
// 系列设备
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);
}
}
// 多组填充
workBook.fill(data, sheet);
// 需手动关流
workBook.finish();*/
String formula_id = MapUtil.getStr(whereJson, "formula_id");
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"));
}
// 球磨
oneMap.put("ball_speed", jsonMaterExt.getString("ball_speed"));
JSONObject jsonQM08 = paraTab.query("material_id = '" + material_id + "' and para_code = 'QM008'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonQM08)) oneMap.put("number_3", jsonQM08.getString("value"));
oneMap.put("create_name", jsonMst.getString("create_name"));
// 查询配方明细-辅料
HashMap<String, String> map = new HashMap<>();
map.put("flag", "1");
map.put("classIds", classIdsFl);
map.put("formula_id", formula_id);
JSONArray flArr = WQL.getWO("QPF_POINTCARD01").addParamMap(map).process().getResultJSONArray(0);
ArrayList<HashMap<String,Object>> flData = new ArrayList<>();
if (ObjectUtil.isNotEmpty(flArr)) {
for (int i = 0; i < flArr.size(); i++) {
HashMap<String, Object> mapFL = new HashMap<>();
JSONObject jsonObject = flArr.getJSONObject(i);
mapFL.put("fl_material_name",jsonObject.getString("material_name"));
mapFL.put("fl_weight",NumberUtil.round(jsonObject.getString("formula_qty"),3));
flData.add(mapFL);
}
}
workBook.fill(oneMap, sheet);
workBook.fill(new FillWrapper("data", flData), sheet);
// workBook.fill(ylData, sheet);
workBook.finish();
/* String formula_id = MapUtil.getStr(whereJson, "formula_id");
WQLObject formMstTab = WQLObject.getWQLObject("PDM_BI_Formula"); // 配方主表
WQLObject formDtlTab = WQLObject.getWQLObject("PDM_BI_FormulaDtl"); // 配方明细表
@@ -673,7 +737,7 @@ public class FormulaServiceImpl implements FormulaService {
workBook.fill(new FillWrapper("data1", ylData), sheet);
workBook.fill(new FillWrapper("data2", flData), sheet);
// workBook.fill(ylData, sheet);
workBook.finish();
workBook.finish();*/
}
@Override

View File

@@ -293,6 +293,7 @@ public class InitformulaServiceImpl implements InitformulaService {
Formula_01.put("total_qty","0");
Formula_01.put("status","10");
Formula_01.put("is_delete", "0");
Formula_01.put("ball_time", whereJson.getString("ball_time"));
Formula_01.put("create_id", currentUserId);
Formula_01.put("create_name", nickName);
Formula_01.put("create_time", now);
@@ -400,6 +401,7 @@ public class InitformulaServiceImpl implements InitformulaService {
Formula_02.put("total_qty","0");
Formula_02.put("status","10");
Formula_02.put("is_delete", "0");
Formula_02.put("ball_time", whereJson.getString("ball_time"));
Formula_02.put("create_id", currentUserId);
Formula_02.put("create_name", nickName);
Formula_02.put("create_time", now);
@@ -576,6 +578,7 @@ public class InitformulaServiceImpl implements InitformulaService {
Formula_01.put("total_qty","0");
Formula_01.put("status","20");
Formula_01.put("is_delete", "0");
Formula_01.put("ball_time", whereJson.getString("ball_time"));
Formula_01.put("create_id", currentUserId);
Formula_01.put("create_name", nickName);
Formula_01.put("create_time", now);
@@ -684,6 +687,7 @@ public class InitformulaServiceImpl implements InitformulaService {
Formula_02.put("total_qty","0");
Formula_02.put("status","20");
Formula_02.put("is_delete", "0");
Formula_02.put("ball_time", whereJson.getString("ball_time"));
Formula_02.put("create_id", currentUserId);
Formula_02.put("create_name", nickName);
Formula_02.put("create_time", now);
@@ -806,6 +810,7 @@ public class InitformulaServiceImpl implements InitformulaService {
@Override
@Transactional(rollbackFor = Exception.class)
public JSONObject getform(Map json) {
WQLObject pdm_bi_workprocedureparaproduct = WQLObject.getWQLObject("pdm_bi_workprocedureparaproduct");
WQLObject MD_ME_ProductMaterialExt = WQLObject.getWQLObject("MD_ME_ProducMaterialExt");
WQLObject md_me_materialbase = WQLObject.getWQLObject("md_me_materialbase");
WQLObject PDM_BI_WorkOrder = WQLObject.getWQLObject("PDM_BI_WorkOrder");
@@ -824,7 +829,14 @@ public class InitformulaServiceImpl implements InitformulaService {
throw new BadRequestException("当前成品查询不到成品物料扩展信息!");
}
JSONObject mater = md_me_materialbase.query("material_id ='"+material_id+"'").uniqueResult(0);
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("当前成品查询不到球磨工艺参数球磨时间!");
}
workorder.put("formula_type","00");
workorder.put("ball_time",materPa.getDouble("value"));
workorder.put("waste_limit_down",material.getString("waste_limit_down"));
workorder.put("waste_limit_up",material.getString("waste_limit_up"));
workorder.put("c_balance",material.getString("c_balance"));

View File

@@ -16,6 +16,8 @@
输入.flag TYPEAS s_string
输入.formula_id TYPEAS s_string
输入.classIds TYPEAS f_string
输入.product_series_id TYPEAS s_string
输入.workprocedure_id TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
@@ -49,7 +51,7 @@
PDM_BI_FormulaDtl dtl
INNER JOIN md_me_materialbase mater ON dtl.material_id = mater.material_id
WHERE
1=1
dtl.is_need_manage = '0'
OPTION 输入.formula_id <> ""
dtl.formula_id = 输入.formula_id
@@ -69,7 +71,7 @@
PDM_BI_FormulaDtl dtl
INNER JOIN md_pb_classstandard class ON dtl.material_id = class.class_id
WHERE
1=1
dtl.is_need_manage = '0'
OPTION 输入.formula_id <> ""
dtl.formula_id = 输入.formula_id
@@ -129,6 +131,84 @@
ORDER BY seq_no ASC
LIMIT 8,100
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "3"
QUERY
SELECT
workDevice.*,
device.device_code
FROM
MPS_BD_CapacityTemplateWorkDevice workDevice
LEFT JOIN EM_BI_DeviceInfo device ON workDevice.device_id = device.device_id
WHERE
device.is_produceuse = '1'
AND device.is_active = '1'
OPTION 输入.product_series_id <> ""
workDevice.product_series_id = 输入.product_series_id
ENDOPTION
OPTION 输入.workprocedure_id <> ""
workDevice.workprocedure_id = 输入.workprocedure_id
ENDOPTION
order by device.device_code ASC
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "4"
QUERY
SELECT
workDevice.*,
device.device_code
FROM
MPS_BD_CapacityTemplateWorkDevice workDevice
LEFT JOIN EM_BI_DeviceInfo device ON workDevice.device_id = device.device_id
WHERE
device.is_produceuse = '1'
AND device.is_active = '1'
OPTION 输入.product_series_id <> ""
workDevice.product_series_id = 输入.product_series_id
ENDOPTION
OPTION 输入.workprocedure_id <> ""
workDevice.workprocedure_id = 输入.workprocedure_id
ENDOPTION
order by device.device_code DESC
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "5"
QUERY
SELECT
workDevice.*,
device.device_name
FROM
MPS_BD_CapacityTemplateWorkDevice workDevice
LEFT JOIN EM_BI_DeviceInfo device ON workDevice.device_id = device.device_id
WHERE
device.is_produceuse = '1'
AND device.is_active = '1'
OPTION 输入.product_series_id <> ""
workDevice.product_series_id = 输入.product_series_id
ENDOPTION
OPTION 输入.workprocedure_id <> ""
workDevice.workprocedure_id = 输入.workprocedure_id
ENDOPTION
order by device.device_code ASC
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -149,7 +149,7 @@ public class OutTask extends AbstractAcsTask {
//任务表
WQLObject wo_Task = WQLObject.getWQLObject("SCH_BASE_Task");
JSONObject task = wo_Task.query("task_status='01' and taskdtl_id='"+taskdtl_id+"'").uniqueResult(0);
JSONObject task = wo_Task.query("is_delete ='0' and task_status='01' and taskdtl_id='"+taskdtl_id+"'").uniqueResult(0);
if(task==null){
throw new BadRequestException("只能取消生成状态的任务!");
}

View File

@@ -946,7 +946,7 @@ public class HandMoveStorServiceImpl implements HandMoveStorService {
map.put("update_optid", currentUserId + "");
map.put("update_optname", nickName);
map.put("update_time", now);
wo_Task.update(map, "task_status='01' and taskdtl_id='" + taskdtl_id + "'");
wo_Task.update(map, "is_delete ='0' and task_status='01' and taskdtl_id='" + taskdtl_id + "'");
} else {
throw new BadRequestException("任务下发失败,请稍后重试!");
}