This commit is contained in:
2022-07-20 19:37:49 +08:00
parent 4f30f55b66
commit 78b220f2ca
12 changed files with 197 additions and 44 deletions

View File

@@ -8,4 +8,6 @@ public interface WmsToErpService {
void getMaterialInfo(Map map);
void getPurchaseInfo(Map map);
void getPurchaseInInfo(Map map);
}

View File

@@ -378,6 +378,36 @@ public class WmsToErpServiceImpl implements WmsToErpService {
}
log.info("采购订单导入数据结束---------成功:" + ja.size() + "");
}
@Override
@Transactional(rollbackFor = Exception.class)
public void getPurchaseInInfo(Map map) {
WQLObject purchaseIn_wql = WQLObject.getWQLObject("EM_BI_ErpPurchaseIn");
HashMap<String, String> whereMap = new HashMap<String, String>();
if (map == null) {
//查询日期
String import_date = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("PURCHASE_IMPORT_DATE").getValue();
whereMap.put("import_date4", import_date);
//更新日期
SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("PURCHASE_IN_IMPORT_DATE").setValue(DateUtil.now());
ParamDto purchase_import_date = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("PURCHASE_IN_IMPORT_DATE");
purchase_import_date.setValue(DateUtil.now());
SpringContextHolder.getBean(ParamServiceImpl.class).update(purchase_import_date);
} else {
whereMap = new HashMap<String, String>(map);
}
JSONArray ja = WQL.getWO("QERP").setDbname("dataSource1").addParamMap(whereMap).addParam("flag", "4").process().getResultJSONArray(0);
log.info("备件入库单导入数据---------:" + ja.toString());
for (int i = 0; i < ja.size(); i++) {
JSONObject jo = ja.getJSONObject(i);
String CGENERALHID = jo.getString("CGENERALHID");
JSONObject purchase = purchaseIn_wql.query("CGENERALHID = '"+CGENERALHID+"'").uniqueResult(0);
if (ObjectUtil.isEmpty(purchase)){
}
}
}
}

View File

@@ -19,10 +19,10 @@
输入.import_date1 TYPEAS s_string
输入.import_date2 TYPEAS s_string
输入.import_date3 TYPEAS s_string
输入.begin_time TYPEAS s_string
输入.end_time TYPEAS s_string
输入.fbillflag TYPEAS s_string
输入.vbillcode TYPEAS s_string
输入.begin_time TYPEAS s_string
输入.end_time TYPEAS s_string
输入.fbillflag TYPEAS s_string
输入.vbillcode TYPEAS s_string
输入.cmaterialvid TYPEAS s_string

View File

@@ -0,0 +1,15 @@
package org.nl.modules.quartz.task;
import lombok.extern.slf4j.Slf4j;
import org.nl.ext.erp.service.WmsToErpService;
import org.nl.utils.SpringContextHolder;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class AutoPruchaseInTask {
public void run () {
WmsToErpService wmsToErpService = SpringContextHolder.getBean(WmsToErpService.class);
wmsToErpService.getPurchaseInInfo(null);
}
}

View File

@@ -176,6 +176,8 @@ public class SparePartServiceImpl implements SparePartService {
io_mst.put("buss_type", "0008");
io_mst.put("io_type", "0");
io_mst.put("bill_type", "000801");
io_mst.put("bizdeptid", deptId);
io_mst.put("bizperson", nickName);
io_mst.put("biz_date", DateUtil.today());
StorattrDto storattrDto = storattrService.findById(Long.parseLong(stor_id));
String stor_code = storattrDto.getStor_code();
@@ -249,13 +251,25 @@ public class SparePartServiceImpl implements SparePartService {
JSONObject jo = JSONObject.parseObject(JSON.toJSONString(jsonObject));
String sparepart_only_id = jo.getString("sparepart_only_id");
String iostorinvdtl_id = jo.getString("iostorinvdtl_id");
String io_flag = jo.getString("io_flag");
JSONObject dtl = WQLObject.getWQLObject("EM_BI_IOStorInvDtl").query("iostorinvdtl_id = '"+iostorinvdtl_id+"'").uniqueResult(0);
HashMap<String, String> map = new HashMap<>();
map.put("flag", "4");
map.put("sparepart_only_id", sparepart_only_id);
map.put("iostorinvdtl_id", iostorinvdtl_id);
JSONObject row = WQL.getWO("QPDAEM_BI_SPAREPART").addParamMap(map).process().uniqueResult(0);
if (io_flag.equals("1") && ObjectUtil.isEmpty(row)){
//如果出库的话查询库存记录表
map.put("flag", "8");
map.put("material_id",dtl.getString("material_id"));
row = WQL.getWO("QPDAEM_BI_SPAREPART").addParamMap(map).process().uniqueResult(0);
}
if (ObjectUtil.isEmpty(row)){
throw new PdaRequestException("请扫描或输入正确的备件唯一码!");
}
JSONObject returnjo = new JSONObject();
returnjo.put("code", "1");
returnjo.put("content", row);
@@ -271,9 +285,42 @@ public class SparePartServiceImpl implements SparePartService {
}
JSONObject jo = JSONObject.parseObject(JSON.toJSONString(jsonObject));
String io_flag = jo.getString("io_flag");
JSONObject form = jo.getJSONObject("form");
if (io_flag.equals("0")) {
sparePartInService.disConfirm(jo);
} else {
//对明细进行循环,如果没有分配标识的,插入到出库分配表中
JSONArray rows = jo.getJSONArray("rows");
JSONArray ja = new JSONArray();
for (int i = 0; i < rows.size(); i++) {
JSONObject row = rows.getJSONObject(i);
if (StrUtil.isEmpty(row.getString("iostorinvdis_id"))){
JSONObject dis_jo = new JSONObject();
dis_jo.put("iostorinvdis_id", IdUtil.getSnowflake(1, 1).nextId());
dis_jo.put("iostorinv_id", form.getString("iostorinv_id"));
dis_jo.put("iostorinvdtl_id", form.getString("iostorinvdtl_id"));
JSONArray ass_dis = WQLObject.getWQLObject("EM_BI_IOStorInvDis").query("iostorinvdtl_id = '" + form.getString("iostorinvdtl_id") + "'").getResultJSONArray(0);
dis_jo.put("disseq_no", ass_dis.size() + 1);
dis_jo.put("material_id", row.getString("material_id"));
dis_jo.put("pcsn", "999999");
dis_jo.put("real_qty", "1");
dis_jo.put("work_status", "01");
dis_jo.put("qty_unit_id", row.getString("qty_unit_id"));
dis_jo.put("qty_unit_name", row.getString("qty_unit_name"));
dis_jo.put("sect_id", row.getString("sect_id"));
dis_jo.put("sect_code", row.getString("sect_code"));
dis_jo.put("sect_name", row.getString("sect_name"));
dis_jo.put("struct_id", row.getString("struct_id"));
dis_jo.put("struct_code", row.getString("struct_code"));
dis_jo.put("struct_name", row.getString("struct_name"));
dis_jo.put("sparepart_only_id", row.getString("sparepart_only_id"));
WQLObject.getWQLObject("EM_BI_IOStorInvDis").insert(dis_jo);
ja.add(dis_jo);
}else {
ja.add(row);
}
}
jo.put("rows",ja);
sparePartOutService.disConfirm(jo);
}
@@ -720,11 +767,13 @@ public class SparePartServiceImpl implements SparePartService {
}
JSONObject jo = JSONObject.parseObject(JSON.toJSONString(jsonObject));
String device_code = jo.getString("device_code");
String run_date = jo.getString("run_date");
JSONObject content = WQL.getWO("QPDAEM_BI_SPAREPART").addParam("flag", "7").addParam("device_code", device_code).process().uniqueResult(0);
if (ObjectUtil.isEmpty(content)) {
throw new PdaRequestException("未查询到相关设备信息!");
if (StrUtil.isEmpty(device_code)){
throw new PdaRequestException("输入的设备编码不能为空!");
}
JSONObject content = WQL.getWO("QPDAEM_BI_SPAREPART").addParam("flag", "7").addParam("device_code", device_code).addParam("run_date",run_date).process().uniqueResult(0);
JSONObject returnjo = new JSONObject();
returnjo.put("code", "1");
returnjo.put("content", content);
@@ -796,6 +845,9 @@ public class SparePartServiceImpl implements SparePartService {
double product_qty = jo.getDoubleValue("product_qty"); //生产总量
double nok_qty = jo.getDoubleValue("nok_qty"); //不合格数
double oee_value = jo.getDoubleValue("oee_value"); //不合格数
if (ObjectUtil.isEmpty(jo.getString("oee_value"))){
throw new PdaRequestException("oee不能为空");
}
double theory_beat = jsonFile.getDoubleValue("theory_beat"); // 理论节拍
JSONObject run = WQLObject.getWQLObject("EM_BI_DeviceRunRecord").query("devicerecord_id = '" + jsonFile.getString("devicerecord_id") + "' AND run_date = '" + jo.getString("run_date") + "'").uniqueResult(0);

View File

@@ -19,6 +19,8 @@
输入.device_code TYPEAS s_string
输入.maintenance_flag TYPEAS s_string
输入.iostorinvdtl_id TYPEAS s_string
输入.material_id TYPEAS s_string
输入.run_date TYPEAS s_string
[临时表]
@@ -92,9 +94,8 @@
mst.bill_code,
mst.device_code,
detail.label AS source_bill_type_name,
IFNULL( a.assign_qty, 0 ) AS finish_qty,
(
dtl.plan_qty - IFNULL( a.assign_qty, 0 )) AS need_qty
round(IFNULL( a.assign_qty, 0 ),3) AS finish_qty,
round((dtl.plan_qty - IFNULL( a.assign_qty, 0 )),3) AS need_qty
FROM
em_bi_iostorinvdtl dtl
LEFT JOIN md_me_materialbase mb ON mb.material_id = dtl.material_id
@@ -125,9 +126,8 @@
mst.bill_code,
mst.device_code,
detail.label AS source_bill_type_name,
IFNULL( a.assign_qty, 0 ) AS finish_qty,
(
dtl.plan_qty - IFNULL( a.assign_qty, 0 )) AS need_qty
round(IFNULL( a.assign_qty, 0 ),3) AS finish_qty,
round((dtl.plan_qty - IFNULL( a.assign_qty, 0 )),3) AS need_qty
FROM
em_bi_iostorinvdtl dtl
LEFT JOIN md_me_materialbase mb ON mb.material_id = dtl.material_id
@@ -245,29 +245,68 @@
ENDQUERY
ENDIF
IF 输入.flag = "7"
QUERY
SELECT
file.device_code,
run.run_times,
run.prepare_times,
run.error_times,
run.adjust_times,
run.product_qty,
run.nok_qty,
run.oee_value,
run.run_date
FROM
em_bi_equipmentfile file
LEFT JOIN em_bi_devicerunrecord run ON run.devicerecord_id = file.devicerecord_id
WHERE
file.is_delete = '0'
OPTION 输入.device_code <> ""
file.device_code = 输入.device_code
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "7"
QUERY
SELECT
file.device_code,
run.run_times,
run.prepare_times,
run.error_times,
run.adjust_times,
run.product_qty,
run.nok_qty,
run.oee_value,
run.run_date
FROM
em_bi_equipmentfile file
LEFT JOIN em_bi_devicerunrecord run ON run.devicerecord_id = file.devicerecord_id AND run.run_date = 输入.run_date
WHERE
file.is_delete = '0'
OPTION 输入.device_code <> ""
file.device_code = 输入.device_code
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "8"
QUERY
SELECT
ivt.material_id,
qty_unit_name,
qty_unit_id,
ivt_qty AS real_qty,
ivt.sparepart_only_id,
mb.material_name,
ivt.struct_name,
sa.sect_id,
sa.sect_code,
sa.sect_name,
sa.struct_id,
sa.struct_code,
sa.struct_name
FROM
EM_BI_DeviceSparePartIvt ivt
LEFT JOIN md_me_materialbase mb ON mb.material_id = ivt.material_id
LEFT JOIN st_ivt_structattr sa ON sa.struct_id = ivt.struct_id
WHERE
ivt.sparepart_only_id NOT IN (
SELECT
dis.sparepart_only_id
FROM
EM_BI_IOStorInv mst
LEFT JOIN EM_BI_IOStorInvDis dis ON mst.iostorinv_id = dis.iostorinv_id
WHERE
io_type = '1'
AND bill_status <> '99'
AND dis.iostorinvdis_id IS NOT NULL
)
AND ivt.sparepart_only_id = 输入.sparepart_only_id
AND ivt.material_id = 输入.material_id
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -384,13 +384,13 @@ public class SparePartOutServiceImpl implements SparePartOutService {
}
String iostorinvdtl_id = rows.getJSONObject(0).getString("iostorinvdtl_id");
JSONArray unfinish_dis = dis_wql.query("iostorinvdtl_id = '" + iostorinvdtl_id + "' AND work_status < '99'").getResultJSONArray(0);
double disassist_qty = unfinish_dis.size();
JSONArray unfinish_dis = dis_wql.query("iostorinvdtl_id = '" + iostorinvdtl_id + "' AND work_status = '99'").getResultJSONArray(0);
double assist_qty = unfinish_dis.size();
JSONObject dtl_jo = dtl_wql.query("iostorinvdtl_id = '" + iostorinvdtl_id + "'").uniqueResult(0);
double plan_qty = dtl_jo.getDoubleValue("plan_qty");
double real_qty = NumberUtil.sub(plan_qty, disassist_qty);
double real_qty = assist_qty;
dtl_jo.put("real_qty", real_qty);
if (disassist_qty == 0) {
if (assist_qty == plan_qty) {
dtl_jo.put("bill_status", "99");
}
dtl_wql.update(dtl_jo);

View File

@@ -497,7 +497,9 @@
out_mst.bizperson like 输入.out_person
ENDOPTION
OPTION 输入.sparepart_only_id <> ""
dis.sparepart_only_id like 输入.sparepart_only_id
(dis.sparepart_only_id like 输入.sparepart_only_id
OR
mb.material_name like 输入.sparepart_only_id)
ENDOPTION
OPTION 输入.in_person <> ""
in_mst.bizperson like 输入.in_person