代码更新
This commit is contained in:
@@ -82,4 +82,10 @@ public class ProductplanprocDto implements Serializable {
|
||||
|
||||
/** 更新时间 */
|
||||
private String update_time;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 任务号 */
|
||||
private String task_code;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.FileUtil;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata.master.service.MaterialbaseService;
|
||||
@@ -128,7 +129,6 @@ public class ProductplanSumServiceImpl implements ProductplanSumService {
|
||||
}
|
||||
|
||||
WQLObject procTab = WQLObject.getWQLObject("pcs_if_productplanproc");
|
||||
WQLObject planTab = WQLObject.getWQLObject("PCS_IF_ProductPlan");
|
||||
dto.setMaterial_id(Long.valueOf(jsonMater.getString("material_id")));
|
||||
dto.setMaterial_code(material_code);
|
||||
dto.setMaterial_name(jsonMater.getString("material_name"));
|
||||
@@ -143,36 +143,18 @@ public class ProductplanSumServiceImpl implements ProductplanSumService {
|
||||
// 更新接口处理表
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
procTab.update(json);
|
||||
// 更新接口表
|
||||
JSONObject jsonPlan = planTab.query("plan_id = '" + dto.getPlan_id() + "'").uniqueResult(0);
|
||||
jsonPlan.put("plan_month", dto.getPlan_month());
|
||||
jsonPlan.put("plan_org_code", dto.getPlan_org_code());
|
||||
jsonPlan.put("plan_org_name", dto.getPlan_org_name());
|
||||
jsonPlan.put("material_id", dto.getMaterial_id());
|
||||
jsonPlan.put("material_code", dto.getMaterial_code());
|
||||
jsonPlan.put("material_name", dto.getMaterial_name());
|
||||
jsonPlan.put("material_spec", dto.getMaterial_spec());
|
||||
jsonPlan.put("product_type_name", dto.getProduct_type_name());
|
||||
jsonPlan.put("weight_unit_id", dto.getWeight_unit_id());
|
||||
jsonPlan.put("weight_unit_name", dto.getWeight_unit_name());
|
||||
jsonPlan.put("product_weight", dto.getProduct_weight());
|
||||
jsonPlan.put("plan_finish_date", dto.getPlan_finish_date());
|
||||
planTab.update(jsonPlan);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
WQLObject procTab = WQLObject.getWQLObject("pcs_if_productplanproc");
|
||||
WQLObject planTab = WQLObject.getWQLObject("PCS_IF_ProductPlan");
|
||||
for (Long plan_id : ids) {
|
||||
JSONObject jsonProc = procTab.query("plan_id = '" + plan_id + "'").uniqueResult(0);
|
||||
JSONObject jsonPlan = planTab.query("plan_id = '" + plan_id + "'").uniqueResult(0);
|
||||
if (StrUtil.equals(jsonProc.getString("is_proc"), IsProcEnum.GENERATE.getCode())) {
|
||||
procTab.delete(jsonProc);
|
||||
planTab.delete(jsonPlan);
|
||||
} else {
|
||||
throw new BadRequestException("不为生成装填,不可删除");
|
||||
throw new BadRequestException("不为生成状态,不可删除");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -181,7 +163,6 @@ public class ProductplanSumServiceImpl implements ProductplanSumService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importExcel(String id) {
|
||||
WQLObject planProcTab = WQLObject.getWQLObject("pcs_if_productplanproc");
|
||||
WQLObject planTab = WQLObject.getWQLObject("pcs_if_productplan");
|
||||
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
|
||||
JSONObject json = WQL.getWO("QPCS_IF_PRODUCTPLANPROC02").addParam("flag", "1").addParam("id", id).process().uniqueResult(0);
|
||||
//根据路径获取表格里的记录
|
||||
@@ -199,6 +180,7 @@ public class ProductplanSumServiceImpl implements ProductplanSumService {
|
||||
String product_type_name = String.valueOf(map.get(5));
|
||||
Long product_weight = Long.valueOf((String) map.get(6));
|
||||
String plan_finish_date = String.valueOf(map.get(7));
|
||||
String remark = String.valueOf(map.get(8));
|
||||
//校验数据准确性
|
||||
JSONObject jsonTab = WQL.getWO("QPCS_IF_PRODUCTPLANPROC02").addParam("flag", "2").addParam("code", plan_org_code).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonTab)) {
|
||||
@@ -237,42 +219,21 @@ public class ProductplanSumServiceImpl implements ProductplanSumService {
|
||||
dto.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
dto.setUpdate_optname(SecurityUtils.getNickName());
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
//月生产计划接口表数据
|
||||
JSONObject jsonPlan = new JSONObject();
|
||||
jsonPlan.put("plan_id", dto.getPlan_id());
|
||||
jsonPlan.put("plan_code", dto.getPlan_code());
|
||||
jsonPlan.put("plan_month", dto.getPlan_month());
|
||||
jsonPlan.put("plan_org_code", dto.getPlan_org_code());
|
||||
jsonPlan.put("plan_org_name", dto.getPlan_org_name());
|
||||
jsonPlan.put("material_id", dto.getMaterial_id());
|
||||
jsonPlan.put("material_code", dto.getMaterial_code());
|
||||
jsonPlan.put("material_name", dto.getMaterial_name());
|
||||
jsonPlan.put("material_spec", dto.getMaterial_spec());
|
||||
jsonPlan.put("product_type_name", dto.getProduct_type_name());
|
||||
jsonPlan.put("weight_unit_id", dto.getWeight_unit_id());
|
||||
jsonPlan.put("weight_unit_name", dto.getWeight_unit_name());
|
||||
jsonPlan.put("product_weight", dto.getProduct_weight());
|
||||
jsonPlan.put("plan_finish_date", dto.getPlan_finish_date());
|
||||
jsonPlan.put("input_optid", dto.getInput_optid());
|
||||
jsonPlan.put("input_optname", dto.getInput_optname());
|
||||
jsonPlan.put("input_time", dto.getInput_time());
|
||||
dto.setRemark(remark);
|
||||
dto.setTask_code(CodeUtil.getNewCode("PCS_TASK_CODE"));
|
||||
//判断表里有没有此条记录
|
||||
JSONObject jsonObject = planProcTab.query("plan_org_code = '" + plan_org_code + "' and plan_month = '" + plan_month + "' and material_code ='" + material_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonObject)) {
|
||||
//如果是空的就插入两张表
|
||||
planProcTab.insert(JSONObject.parseObject(JSON.toJSONString(dto)));
|
||||
planTab.insert(jsonPlan);
|
||||
} else {
|
||||
if (!StrUtil.equals(jsonObject.getString("is_proc"), IsProcEnum.GENERATE.getCode())) {
|
||||
//非生成状态 返回错误信息
|
||||
throw new BadRequestException("此月度计划已存在并不可在修改");
|
||||
} else {
|
||||
//如果是生成状态则将当前记录删除,在重新插入
|
||||
JSONObject deletePlan = planTab.query("plan_id = '" + jsonObject.getString("plan_id") + "'").uniqueResult(0);
|
||||
planProcTab.delete(jsonObject);
|
||||
planTab.delete(deletePlan);
|
||||
planProcTab.insert(JSONObject.parseObject(JSON.toJSONString(dto)));
|
||||
planTab.insert(jsonPlan);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.FileUtil;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata.master.service.MaterialbaseService;
|
||||
@@ -178,7 +179,6 @@ public class ProductplanprocServiceImpl implements ProductplanprocService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importExcel(String id) {
|
||||
WQLObject planProcTab = WQLObject.getWQLObject("pcs_if_productplanproc");
|
||||
WQLObject planTab = WQLObject.getWQLObject("pcs_if_productplan");
|
||||
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
|
||||
JSONObject json = WQL.getWO("QPCS_IF_PRODUCTPLANPROC02").addParam("flag", "1").addParam("id", id).process().uniqueResult(0);
|
||||
//根据路径获取表格里的记录
|
||||
@@ -196,6 +196,7 @@ public class ProductplanprocServiceImpl implements ProductplanprocService {
|
||||
String product_type_name = String.valueOf(map.get(5));
|
||||
Long product_weight = Long.valueOf((String) map.get(6));
|
||||
String plan_finish_date = String.valueOf(map.get(7));
|
||||
String remark = String.valueOf(map.get(8));
|
||||
//校验数据准确性
|
||||
JSONObject jsonTab = WQL.getWO("QPCS_IF_PRODUCTPLANPROC02").addParam("flag", "2").addParam("code", plan_org_code).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonTab)) {
|
||||
@@ -234,42 +235,21 @@ public class ProductplanprocServiceImpl implements ProductplanprocService {
|
||||
dto.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
dto.setUpdate_optname(SecurityUtils.getNickName());
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
//月生产计划接口表数据
|
||||
JSONObject jsonPlan = new JSONObject();
|
||||
jsonPlan.put("plan_id", dto.getPlan_id());
|
||||
jsonPlan.put("plan_code", dto.getPlan_code());
|
||||
jsonPlan.put("plan_month", dto.getPlan_month());
|
||||
jsonPlan.put("plan_org_code", dto.getPlan_org_code());
|
||||
jsonPlan.put("plan_org_name", dto.getPlan_org_name());
|
||||
jsonPlan.put("material_id", dto.getMaterial_id());
|
||||
jsonPlan.put("material_code", dto.getMaterial_code());
|
||||
jsonPlan.put("material_name", dto.getMaterial_name());
|
||||
jsonPlan.put("material_spec", dto.getMaterial_spec());
|
||||
jsonPlan.put("product_type_name", dto.getProduct_type_name());
|
||||
jsonPlan.put("weight_unit_id", dto.getWeight_unit_id());
|
||||
jsonPlan.put("weight_unit_name", dto.getWeight_unit_name());
|
||||
jsonPlan.put("product_weight", dto.getProduct_weight());
|
||||
jsonPlan.put("plan_finish_date", dto.getPlan_finish_date());
|
||||
jsonPlan.put("input_optid", dto.getInput_optid());
|
||||
jsonPlan.put("input_optname", dto.getInput_optname());
|
||||
jsonPlan.put("input_time", dto.getInput_time());
|
||||
dto.setRemark(remark);
|
||||
dto.setTask_code(CodeUtil.getNewCode("PCS_TASK_CODE"));
|
||||
//判断表里有没有此条记录
|
||||
JSONObject jsonObject = planProcTab.query("plan_org_code = '" + plan_org_code + "' and plan_month = '" + plan_month + "' and material_code ='" + material_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonObject)) {
|
||||
//如果是空的就插入两张表
|
||||
planProcTab.insert(JSONObject.parseObject(JSON.toJSONString(dto)));
|
||||
planTab.insert(jsonPlan);
|
||||
} else {
|
||||
if (!StrUtil.equals(jsonObject.getString("is_proc"), IsProcEnum.GENERATE.getCode())) {
|
||||
//非生成状态 返回错误信息
|
||||
throw new BadRequestException("此月度计划已存在并不可在修改");
|
||||
} else {
|
||||
//如果是生成状态则将当前记录删除,在重新插入
|
||||
JSONObject deletePlan = planTab.query("plan_id = '" + jsonObject.getString("plan_id") + "'").uniqueResult(0);
|
||||
planProcTab.delete(jsonObject);
|
||||
planTab.delete(deletePlan);
|
||||
planProcTab.insert(JSONObject.parseObject(JSON.toJSONString(dto)));
|
||||
planTab.insert(jsonPlan);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,9 +39,6 @@ public class DeviceooestatServiceImpl implements DeviceooestatService {
|
||||
String dept_code = MapUtil.getStr(whereJson, "dept_code");
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "1");
|
||||
map.put("begin_time", begin_time);
|
||||
map.put("end_time", end_time);
|
||||
if (ObjectUtil.isNotEmpty(device_code)) map.put("device_code","%"+device_code+"%");
|
||||
if (ObjectUtil.isNotEmpty(dept_code)) map.put("dept_code","%"+dept_code+"%");
|
||||
//处理物料当前节点的所有子节点
|
||||
@@ -53,7 +50,16 @@ public class DeviceooestatServiceImpl implements DeviceooestatService {
|
||||
String classIds = classstandardService.getAllChildIdStr(class_idStr);
|
||||
map.put("classIds", classIds);
|
||||
}
|
||||
JSONObject json = WQL.getWO("EM_DEVICEOOESTAT001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "run.create_time DESC");
|
||||
|
||||
if (ObjectUtil.isEmpty(begin_time)) {
|
||||
map.put("flag", "1");
|
||||
} else {
|
||||
map.put("flag", "2");
|
||||
map.put("begin_time",begin_time);
|
||||
map.put("end_time",end_time);
|
||||
}
|
||||
JSONObject json = WQL.getWO("EM_DEVICEOOESTAT001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "file.device_code ASC");
|
||||
|
||||
return json;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,5 +86,57 @@
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
SUM(run.run_times) AS run_times,
|
||||
SUM(run.prepare_times) AS prepare_times,
|
||||
SUM(run.error_times) AS error_times,
|
||||
SUM(run.adjust_times) AS adjust_times,
|
||||
SUM(run.product_qty) AS product_qty,
|
||||
SUM(run.nok_qty) AS nok_qty,
|
||||
SUM(file.theory_beat) AS theory_beat,
|
||||
SUM(run.oee_value) AS oee_value,
|
||||
class.class_name,
|
||||
file.device_code,
|
||||
file.device_name,
|
||||
file.devicerecord_id,
|
||||
dept.name AS dept_name
|
||||
FROM
|
||||
EM_BI_DeviceRunRecord run
|
||||
LEFT JOIN EM_BI_EquipmentFile file ON file.devicerecord_id = run.devicerecord_id
|
||||
LEFT JOIN md_pb_classstandard class ON file.material_type_id = class.class_id
|
||||
LEFT JOIN sys_dept dept ON file.use_deptid = dept.dept_id
|
||||
WHERE
|
||||
file.is_delete = '0'
|
||||
|
||||
OPTION 输入.device_code <> ""
|
||||
(file.device_code like 输入.device_code or
|
||||
file.device_name like 输入.device_code)
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.dept_code <> ""
|
||||
(dept.name like 输入.dept_code or
|
||||
dept.code like 输入.dept_code)
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.classIds <> ""
|
||||
class.class_id in 输入.classIds
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.begin_time <> ""
|
||||
run.run_date >= 输入.begin_time
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.end_time <> ""
|
||||
run.run_date <= 输入.end_time
|
||||
ENDOPTION
|
||||
|
||||
group by run.devicerecord_id
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user