|
|
|
|
@@ -295,7 +295,7 @@ public class WmsToErpServiceImpl implements WmsToErpService {
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(purchase_jo)) {
|
|
|
|
|
//判断是否生成了入库单
|
|
|
|
|
JSONObject dtl = WQLObject.getWQLObject("st_ivt_iostorinvdtl").query("source_billdtl_id = '"+purchase_jo.getString("id")+"'").uniqueResult(0);
|
|
|
|
|
JSONObject dtl = WQLObject.getWQLObject("st_ivt_iostorinvdtl").query("source_billdtl_id = '" + purchase_jo.getString("id") + "'").uniqueResult(0);
|
|
|
|
|
if (purchase_jo.getString("proc_status").equals("01") && ObjectUtil.isEmpty(dtl)) {
|
|
|
|
|
//删除
|
|
|
|
|
purchase_wql.delete("PURCHASE_ID_B = '" + PURCHASE_ID_B + "'");
|
|
|
|
|
@@ -315,13 +315,13 @@ public class WmsToErpServiceImpl implements WmsToErpService {
|
|
|
|
|
String CROWNO = jo2.getString("crowno");
|
|
|
|
|
String CREATE_BY = jo2.getString("create_by");
|
|
|
|
|
String CREATE_DATE = jo2.getString("create_date");
|
|
|
|
|
if (StrUtil.isNotEmpty(CREATE_DATE)){
|
|
|
|
|
CREATE_DATE = DateUtil.parse(CREATE_DATE,"yyyy-MM-dd HH:mm:ss").toString();
|
|
|
|
|
if (StrUtil.isNotEmpty(CREATE_DATE)) {
|
|
|
|
|
CREATE_DATE = DateUtil.parse(CREATE_DATE, "yyyy-MM-dd HH:mm:ss").toString();
|
|
|
|
|
}
|
|
|
|
|
String UPDATED_BY = jo2.getString("updated_by");
|
|
|
|
|
String UPDATED_DATE = jo2.getString("updated_date");
|
|
|
|
|
if (StrUtil.isNotEmpty(UPDATED_DATE)){
|
|
|
|
|
UPDATED_DATE = DateUtil.parse(UPDATED_DATE,"yyyy-MM-dd HH:mm:ss").toString();
|
|
|
|
|
if (StrUtil.isNotEmpty(UPDATED_DATE)) {
|
|
|
|
|
UPDATED_DATE = DateUtil.parse(UPDATED_DATE, "yyyy-MM-dd HH:mm:ss").toString();
|
|
|
|
|
}
|
|
|
|
|
String ITEM_ID = jo2.getString("item_id");
|
|
|
|
|
String M_UNIT_ID = jo2.getString("m_unit_id");
|
|
|
|
|
@@ -366,16 +366,16 @@ public class WmsToErpServiceImpl implements WmsToErpService {
|
|
|
|
|
jo.put("input_optid", "");
|
|
|
|
|
jo.put("input_optname", "");
|
|
|
|
|
jo.put("input_time", DateUtil.now());
|
|
|
|
|
try{
|
|
|
|
|
try {
|
|
|
|
|
purchase_wql.insert(jo);
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
throw new BadRequestException("订单号:"+VBILLCODE+"数据存在问题!");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new BadRequestException("订单号:" + VBILLCODE + "数据存在问题!");
|
|
|
|
|
}
|
|
|
|
|
jo.put("proc_status", "01");
|
|
|
|
|
try{
|
|
|
|
|
try {
|
|
|
|
|
purchase_proc_wql.insert(jo);
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
throw new BadRequestException("订单号:"+VBILLCODE+"数据存在问题!");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new BadRequestException("订单号:" + VBILLCODE + "数据存在问题!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@@ -389,11 +389,11 @@ public class WmsToErpServiceImpl implements WmsToErpService {
|
|
|
|
|
HashMap<String, String> whereMap = new HashMap<String, String>();
|
|
|
|
|
if (map == null) {
|
|
|
|
|
//查询日期
|
|
|
|
|
String import_date = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("PURCHASE_IMPORT_DATE").getValue();
|
|
|
|
|
String import_date = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("PURCHASE_SPARE_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");
|
|
|
|
|
SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("PURCHASE_SPARE_DATE").setValue(DateUtil.now());
|
|
|
|
|
ParamDto purchase_import_date = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("PURCHASE_SPARE_DATE");
|
|
|
|
|
purchase_import_date.setValue(DateUtil.now());
|
|
|
|
|
SpringContextHolder.getBean(ParamServiceImpl.class).update(purchase_import_date);
|
|
|
|
|
} else {
|
|
|
|
|
@@ -406,45 +406,45 @@ public class WmsToErpServiceImpl implements WmsToErpService {
|
|
|
|
|
for (int i = 0; i < ja.size(); i++) {
|
|
|
|
|
JSONObject jo = ja.getJSONObject(i);
|
|
|
|
|
String CGENERALBID = jo.getString("cgeneralbid");
|
|
|
|
|
JSONObject purchase = purchaseIn_wql.query("CGENERALBID = '"+CGENERALBID+"'").uniqueResult(0);
|
|
|
|
|
if (ObjectUtil.isEmpty(purchase)){
|
|
|
|
|
JSONObject purchase = purchaseIn_wql.query("CGENERALBID = '" + CGENERALBID + "'").uniqueResult(0);
|
|
|
|
|
if (ObjectUtil.isEmpty(purchase)) {
|
|
|
|
|
purchase = new JSONObject();
|
|
|
|
|
purchase.put("id", IdUtil.getSnowflake(1, 1).nextId());
|
|
|
|
|
purchase.put("CGENERALHID",jo.getString("cgeneralhid"));
|
|
|
|
|
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("input_optid","1452555001116364823");
|
|
|
|
|
purchase.put("input_optname","mes系统");
|
|
|
|
|
purchase.put("input_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 {
|
|
|
|
|
purchase.put("CGENERALHID", jo.getString("cgeneralhid"));
|
|
|
|
|
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("input_optid", "1452555001116364823");
|
|
|
|
|
purchase.put("input_optname", "mes系统");
|
|
|
|
|
purchase.put("input_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")){
|
|
|
|
|
if (jo.getString("fbillflag").equals("3")) {
|
|
|
|
|
//生成入库单
|
|
|
|
|
JSONObject io_mst = new JSONObject();
|
|
|
|
|
String iostorinv_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
|
|
|
|
@@ -459,7 +459,7 @@ public class WmsToErpServiceImpl implements WmsToErpService {
|
|
|
|
|
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("total_qty", purchase.getString("QTY"));
|
|
|
|
|
io_mst.put("detail_count", "1");
|
|
|
|
|
io_mst.put("bill_status", "10");
|
|
|
|
|
io_mst.put("create_mode", "01");
|
|
|
|
|
@@ -482,67 +482,67 @@ public class WmsToErpServiceImpl implements WmsToErpService {
|
|
|
|
|
io_dtl.put("iostorinv_id", iostorinv_id);
|
|
|
|
|
io_dtl.put("seq_no", "1");
|
|
|
|
|
io_dtl.put("bill_status", "10");
|
|
|
|
|
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbase").query("ext_id = '"+purchase.getString("ITEM_ID")+"'").uniqueResult(0);
|
|
|
|
|
if (ObjectUtil.isEmpty(mater_jo)){
|
|
|
|
|
log.info("未查询到外部标识为:"+purchase.getString("ITEM_ID")+"的物料!");
|
|
|
|
|
throw new BadRequestException("未查询到外部标识为:"+purchase.getString("ITEM_ID")+"的物料!");
|
|
|
|
|
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbase").query("ext_id = '" + purchase.getString("ITEM_ID") + "'").uniqueResult(0);
|
|
|
|
|
if (ObjectUtil.isEmpty(mater_jo)) {
|
|
|
|
|
log.info("未查询到外部标识为:" + purchase.getString("ITEM_ID") + "的物料!");
|
|
|
|
|
throw new BadRequestException("未查询到外部标识为:" + purchase.getString("ITEM_ID") + "的物料!");
|
|
|
|
|
}
|
|
|
|
|
io_dtl.put("material_id",mater_jo.getString("material_id"));
|
|
|
|
|
io_dtl.put("pcsn",purchase.getString("VBATCHCODE"));
|
|
|
|
|
JSONObject qty_jo = WQLObject.getWQLObject("md_pb_measureunit").query("ext_id = '"+purchase.getString("UNIT")+"'").uniqueResult(0);
|
|
|
|
|
io_dtl.put("qty_unit_id",qty_jo.getString("measure_unit_id"));
|
|
|
|
|
io_dtl.put("qty_unit_name",qty_jo.getString("unit_name"));
|
|
|
|
|
io_dtl.put("plan_qty",purchase.getString("qty"));
|
|
|
|
|
io_dtl.put("source_billdtl_id",purchase.getString("id"));
|
|
|
|
|
io_dtl.put("source_bill_type",purchase.getString("PO"));
|
|
|
|
|
io_dtl.put("source_bill_code",purchase.getString("VBILLCODE"));
|
|
|
|
|
io_dtl.put("source_bill_table",purchase.getString("EM_BI_ErpPurchaseIn"));
|
|
|
|
|
io_dtl.put("base_billdtl_id",purchase.getString("id"));
|
|
|
|
|
io_dtl.put("base_bill_type",purchase.getString("PO"));
|
|
|
|
|
io_dtl.put("base_bill_code",purchase.getString("VBILLCODE"));
|
|
|
|
|
io_dtl.put("base_bill_table",purchase.getString("EM_BI_ErpPurchaseIn"));
|
|
|
|
|
io_dtl.put("remark_ext",purchase.getString("CGENERALHID"));
|
|
|
|
|
io_dtl.put("material_id", mater_jo.getString("material_id"));
|
|
|
|
|
io_dtl.put("pcsn", purchase.getString("VBATCHCODE"));
|
|
|
|
|
JSONObject qty_jo = WQLObject.getWQLObject("md_pb_measureunit").query("ext_id = '" + purchase.getString("UNIT") + "'").uniqueResult(0);
|
|
|
|
|
io_dtl.put("qty_unit_id", qty_jo.getString("measure_unit_id"));
|
|
|
|
|
io_dtl.put("qty_unit_name", qty_jo.getString("unit_name"));
|
|
|
|
|
io_dtl.put("plan_qty", purchase.getString("QTY"));
|
|
|
|
|
io_dtl.put("source_billdtl_id", purchase.getString("id"));
|
|
|
|
|
io_dtl.put("source_bill_type", "PO");
|
|
|
|
|
io_dtl.put("source_bill_code", purchase.getString("VBILLCODE"));
|
|
|
|
|
io_dtl.put("source_bill_table", "EM_BI_ErpPurchaseIn");
|
|
|
|
|
io_dtl.put("base_billdtl_id", purchase.getString("id"));
|
|
|
|
|
io_dtl.put("base_bill_type", "PO");
|
|
|
|
|
io_dtl.put("base_bill_code", purchase.getString("VBILLCODE"));
|
|
|
|
|
io_dtl.put("base_bill_table", "EM_BI_ErpPurchaseIn");
|
|
|
|
|
io_dtl.put("remark_ext", purchase.getString("CGENERALHID"));
|
|
|
|
|
WQLObject.getWQLObject("EM_BI_IOStorInvDtl").insert(io_dtl);
|
|
|
|
|
}
|
|
|
|
|
purchaseIn_wql.insert(purchase);
|
|
|
|
|
}else {
|
|
|
|
|
if (purchase.getString("proc_status").equals("02")){
|
|
|
|
|
} 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 {
|
|
|
|
|
} 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")){
|
|
|
|
|
if (jo.getString("fbillflag").equals("3")) {
|
|
|
|
|
//生成入库单
|
|
|
|
|
JSONObject io_mst = new JSONObject();
|
|
|
|
|
String iostorinv_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
|
|
|
|
@@ -557,7 +557,7 @@ public class WmsToErpServiceImpl implements WmsToErpService {
|
|
|
|
|
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("total_qty", purchase.getString("QTY"));
|
|
|
|
|
io_mst.put("detail_count", "1");
|
|
|
|
|
io_mst.put("bill_status", "10");
|
|
|
|
|
io_mst.put("create_mode", "01");
|
|
|
|
|
@@ -580,26 +580,26 @@ public class WmsToErpServiceImpl implements WmsToErpService {
|
|
|
|
|
io_dtl.put("iostorinv_id", iostorinv_id);
|
|
|
|
|
io_dtl.put("seq_no", "1");
|
|
|
|
|
io_dtl.put("bill_status", "10");
|
|
|
|
|
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbase").query("ext_id = '"+purchase.getString("ITEM_ID")+"'").uniqueResult(0);
|
|
|
|
|
if (ObjectUtil.isEmpty(mater_jo)){
|
|
|
|
|
log.info("未查询到外部标识为:"+purchase.getString("ITEM_ID")+"的物料!");
|
|
|
|
|
throw new BadRequestException("未查询到外部标识为:"+purchase.getString("ITEM_ID")+"的物料!");
|
|
|
|
|
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbase").query("ext_id = '" + purchase.getString("ITEM_ID") + "'").uniqueResult(0);
|
|
|
|
|
if (ObjectUtil.isEmpty(mater_jo)) {
|
|
|
|
|
log.info("未查询到外部标识为:" + purchase.getString("ITEM_ID") + "的物料!");
|
|
|
|
|
throw new BadRequestException("未查询到外部标识为:" + purchase.getString("ITEM_ID") + "的物料!");
|
|
|
|
|
}
|
|
|
|
|
io_dtl.put("material_id",mater_jo.getString("material_id"));
|
|
|
|
|
io_dtl.put("pcsn",purchase.getString("VBATCHCODE"));
|
|
|
|
|
JSONObject qty_jo = WQLObject.getWQLObject("md_pb_measureunit").query("ext_id = '"+purchase.getString("UNIT")+"'").uniqueResult(0);
|
|
|
|
|
io_dtl.put("qty_unit_id",qty_jo.getString("measure_unit_id"));
|
|
|
|
|
io_dtl.put("qty_unit_name",qty_jo.getString("unit_name"));
|
|
|
|
|
io_dtl.put("plan_qty",purchase.getString("qty"));
|
|
|
|
|
io_dtl.put("source_billdtl_id",purchase.getString("id"));
|
|
|
|
|
io_dtl.put("source_bill_type",purchase.getString("PO"));
|
|
|
|
|
io_dtl.put("source_bill_code",purchase.getString("VBILLCODE"));
|
|
|
|
|
io_dtl.put("source_bill_table",purchase.getString("EM_BI_ErpPurchaseIn"));
|
|
|
|
|
io_dtl.put("base_billdtl_id",purchase.getString("id"));
|
|
|
|
|
io_dtl.put("base_bill_type",purchase.getString("PO"));
|
|
|
|
|
io_dtl.put("base_bill_code",purchase.getString("VBILLCODE"));
|
|
|
|
|
io_dtl.put("base_bill_table",purchase.getString("EM_BI_ErpPurchaseIn"));
|
|
|
|
|
io_dtl.put("remark_ext",purchase.getString("CGENERALHID"));
|
|
|
|
|
io_dtl.put("material_id", mater_jo.getString("material_id"));
|
|
|
|
|
io_dtl.put("pcsn", purchase.getString("VBATCHCODE"));
|
|
|
|
|
JSONObject qty_jo = WQLObject.getWQLObject("md_pb_measureunit").query("ext_id = '" + purchase.getString("UNIT") + "'").uniqueResult(0);
|
|
|
|
|
io_dtl.put("qty_unit_id", qty_jo.getString("measure_unit_id"));
|
|
|
|
|
io_dtl.put("qty_unit_name", qty_jo.getString("unit_name"));
|
|
|
|
|
io_dtl.put("plan_qty", purchase.getString("QTY"));
|
|
|
|
|
io_dtl.put("source_billdtl_id", purchase.getString("id"));
|
|
|
|
|
io_dtl.put("source_bill_type", "PO");
|
|
|
|
|
io_dtl.put("source_bill_code", purchase.getString("VBILLCODE"));
|
|
|
|
|
io_dtl.put("source_bill_table", "EM_BI_ErpPurchaseIn");
|
|
|
|
|
io_dtl.put("base_billdtl_id", purchase.getString("id"));
|
|
|
|
|
io_dtl.put("base_bill_type", "PO");
|
|
|
|
|
io_dtl.put("base_bill_code", purchase.getString("VBILLCODE"));
|
|
|
|
|
io_dtl.put("base_bill_table", "EM_BI_ErpPurchaseIn");
|
|
|
|
|
io_dtl.put("remark_ext", purchase.getString("CGENERALHID"));
|
|
|
|
|
WQLObject.getWQLObject("EM_BI_IOStorInvDtl").insert(io_dtl);
|
|
|
|
|
}
|
|
|
|
|
purchaseIn_wql.update(purchase);
|
|
|
|
|
|