|
|
|
|
@@ -405,46 +405,46 @@ public class WmsToErpServiceImpl implements WmsToErpService {
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < ja.size(); i++) {
|
|
|
|
|
JSONObject jo = ja.getJSONObject(i);
|
|
|
|
|
String CGENERALBID = jo.getString("CGENERALBID");
|
|
|
|
|
String CGENERALBID = jo.getString("cgeneralbid");
|
|
|
|
|
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("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")){
|
|
|
|
|
if (jo.getString("fbillflag").equals("2")){
|
|
|
|
|
purchase.put("proc_status","01");
|
|
|
|
|
}else if (jo.getString("FBILLFLAG").equals("3")){
|
|
|
|
|
}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() + "";
|
|
|
|
|
@@ -492,12 +492,12 @@ public class WmsToErpServiceImpl implements WmsToErpService {
|
|
|
|
|
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("CGENERALBID"));
|
|
|
|
|
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("CGENERALBID"));
|
|
|
|
|
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"));
|
|
|
|
|
@@ -509,40 +509,40 @@ public class WmsToErpServiceImpl implements WmsToErpService {
|
|
|
|
|
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("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")){
|
|
|
|
|
if (jo.getString("fbillflag").equals("2")){
|
|
|
|
|
purchase.put("proc_status","01");
|
|
|
|
|
}else if (jo.getString("FBILLFLAG").equals("3")){
|
|
|
|
|
}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() + "";
|
|
|
|
|
@@ -590,12 +590,12 @@ public class WmsToErpServiceImpl implements WmsToErpService {
|
|
|
|
|
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("CGENERALBID"));
|
|
|
|
|
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("CGENERALBID"));
|
|
|
|
|
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"));
|
|
|
|
|
|