This commit is contained in:
2022-07-21 13:43:37 +08:00
parent ade3f8a31b
commit afcaac77e4
3 changed files with 91 additions and 13 deletions

View File

@@ -10,13 +10,15 @@ import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.nl.exception.BadRequestException;
import org.nl.ext.erp.service.WmsToErpService;
import org.nl.modules.security.service.dto.JwtUserDto;
import org.nl.modules.system.service.dto.ParamDto;
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.service.impl.ClassstandardServiceImpl;
import org.nl.wms.basedata.st.service.dto.StorattrDto;
import org.nl.wql.WQL;
import org.nl.wql.core.bean.ResultBean;
import org.nl.wql.core.bean.WQLObject;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -441,17 +443,93 @@ public class WmsToErpServiceImpl implements WmsToErpService {
}else {
throw new BadRequestException("备件采购订单状态不符!");
}
if (jo.getString("FBILLFLAG").equals("3")){
//生成入库单
}
purchaseIn_wql.insert(purchase);
}else {
if (purchase.getString("proc_status").equals("02")){
continue;
}else {
purchase.put("CGENERALBID",jo.getString("CGENERALBID"));
purchase.put("CROWNO",jo.getString("CROWNO"));
purchase.put("ITEM_ID",jo.getString("ITEM_ID"));
purchase.put("ITEM_NO",jo.getString("ITEM_NO"));
purchase.put("ITEM_NAME",jo.getString("ITEM_NAME"));
purchase.put("MATERIALSPEC",jo.getString("MATERIALSPEC"));
purchase.put("MATERIALTYPE",jo.getString("MATERIALTYPE"));
purchase.put("VBILLCODE",jo.getString("VBILLCODE"));
purchase.put("DBILLDATE",jo.getString("DBILLDATE"));
purchase.put("DR",jo.getString("DR"));
purchase.put("CREATOR",jo.getString("CREATOR"));
purchase.put("CREATIONTIME",jo.getString("CREATIONTIME"));
purchase.put("T_NOTE",jo.getString("T_NOTE"));
purchase.put("FBILLFLAG",jo.getString("FBILLFLAG"));
purchase.put("QTY",jo.getString("QTY"));
purchase.put("F_QTY",jo.getString("F_QTY"));
purchase.put("UNIT",jo.getString("UNIT"));
purchase.put("F_UNIT",jo.getString("F_UNIT"));
purchase.put("D_NOTE",jo.getString("D_NOTE"));
purchase.put("VBATCHCODE",jo.getString("VBATCHCODE"));
purchase.put("PK_BATCHCODE",jo.getString("PK_BATCHCODE"));
purchase.put("CG_EMPL",jo.getString("CG_EMPL"));
purchase.put("VEND_NAME",jo.getString("VEND_NAME"));
purchase.put("update_optid","1452555001116364823");
purchase.put("update_optname","mes系统");
purchase.put("update_time",DateUtil.now());
if (jo.getString("FBILLFLAG").equals("2")){
purchase.put("proc_status","01");
}else if (jo.getString("FBILLFLAG").equals("3")){
purchase.put("proc_status","02");
}else {
throw new BadRequestException("备件采购订单状态不符!");
}
if (jo.getString("FBILLFLAG").equals("3")){
//生成入库单
JSONObject io_mst = new JSONObject();
String iostorinv_id = IdUtil.getSnowflake(1, 1).nextId() + "";
String bill_code = CodeUtil.getNewCode("IO_CODE");
io_mst.put("iostorinv_id", iostorinv_id);
io_mst.put("bill_code", bill_code);
io_mst.put("buss_type", "0007");
io_mst.put("io_type", "0");
io_mst.put("bill_type", "000701");
io_mst.put("biz_date", DateUtil.today());
JSONObject stor_jo = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("is_attachment = '1'").uniqueResult(0);
io_mst.put("stor_id", stor_jo.getString("stor_id"));
io_mst.put("stor_code", stor_jo.getString("stor_code"));
io_mst.put("stor_name", stor_jo.getString("stor_name"));
io_mst.put("total_qty", purchase.getString("QTY"));
io_mst.put("detail_count", "1");
io_mst.put("bill_status", "10");
io_mst.put("create_mode", "01");
io_mst.put("input_optid", currentUserId + "");
io_mst.put("input_optname", nickName);
io_mst.put("input_time", now);
io_mst.put("update_optid", currentUserId + "");
io_mst.put("update_optname", nickName);
io_mst.put("update_time", now);
io_mst.put("is_delete", "0");
io_mst.put("is_upload", "0");
JwtUserDto currentUser = (JwtUserDto) SecurityUtils.getCurrentUser();
Long deptId = currentUser.getDeptId();
io_mst.put("sysdeptid", deptId + "");
io_mst.put("syscompanyid", deptId + "");
io_mst.put("bizdeptid", deptId + "");
for (int i = 0; i < rows.size(); i++) {
HashMap<String, String> row = rows.get(i);
row.put("iostorinvdtl_id", IdUtil.getSnowflake(1, 1).nextId() + "");
row.put("iostorinv_id", iostorinv_id);
row.put("seq_no", (i + 1) + "");
row.put("bill_status", "10");
WQLObject.getWQLObject("EM_BI_IOStorInvDtl").insert(row);
/* update_optid
update_optname
update_time*/
}
WQLObject.getWQLObject("EM_BI_IOStorInv").insert(io_mst);
}
purchaseIn_wql.update(purchase);
}
}
}
}

View File

@@ -707,7 +707,7 @@ public class SparePartServiceImpl implements SparePartService {
// 更新主表
JSONObject jsonMst = mstTab.query("repair_id ='" + repair_id + "'").uniqueResult(0);
if (!jsonMst.getString("invstatus").equals("02")) {
if (!jsonMst.getString("invstatus").equals("03")) {
throw new PdaRequestException("只能对开始状态的单据进行填报确认");
}
jsonMst.put("update_optname", SecurityUtils.getNickName());

View File

@@ -489,7 +489,7 @@ public class SparePartOutServiceImpl implements SparePartOutService {
record_jo.put("source_bill_table", "EM_BI_IOStorInv");
WQLObject.getWQLObject("EM_BI_DeviceSparePartIOStorInvRecord").insert(record_jo);
if (StrUtil.isNotEmpty(mst.getString("device_id")) && mst.getString("bill_type").equals("010901")) {
/*if (StrUtil.isNotEmpty(mst.getString("device_id")) && mst.getString("bill_type").equals("010901")) {
JSONObject bom = new JSONObject();
bom.put("device_file_spare_id", IdUtil.getSnowflake(1, 1).nextId());
bom.put("devicerecord_id", mst.getString("device_id"));
@@ -500,7 +500,7 @@ public class SparePartOutServiceImpl implements SparePartOutService {
bom.put("qty_unit_name", row.getString("qty_unit_name"));
bom.put("qty", "1");
WQLObject.getWQLObject("EM_BI_EquipmentSpareBOM").insert(bom);
}
}*/
}
}
}