|
|
@@ -0,0 +1,254 @@
|
|
|
+package com.uas.eis.listener;
|
|
|
+
|
|
|
+import com.uas.eis.aspect.UasEventListener;
|
|
|
+import com.uas.eis.config.KingdeeConfig;
|
|
|
+import com.uas.eis.core.enums.KingdeeFormId;
|
|
|
+import com.uas.eis.dto.UasEvent;
|
|
|
+import com.uas.eis.entity.K3.CommonSaveReq;
|
|
|
+import com.uas.eis.entity.K3.FNumberE;
|
|
|
+import com.uas.eis.entity.K3.ProdInoutPickingF;
|
|
|
+import com.uas.eis.entity.K3.ProdInoutPickingSaveReqModel;
|
|
|
+import com.uas.eis.entity.ProdInOut;
|
|
|
+import com.uas.eis.service.ProdInOutService;;
|
|
|
+import kingdee.bos.webapi.client.K3CloudApiClient;
|
|
|
+import net.sf.json.JSONObject;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author: zhouy
|
|
|
+ * @date: 2021/9/26 10:47
|
|
|
+ * @desc: 出入库单事件处理
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class UasProdInOutListener {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private KingdeeConfig kingdeeConfig;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ProdInOutService prodInOutService;
|
|
|
+ /**
|
|
|
+ * 生产领料单过账->推送金蝶生成对应单据
|
|
|
+ */
|
|
|
+ @UasEventListener(caller = "ProdInOut!Picking", operation = "POST")
|
|
|
+ public void onProdInOutPost_picking(UasEvent event) {
|
|
|
+ ProdInOut prodInout = prodInOutService.findById(Integer.parseInt(event.getKey().toString()));
|
|
|
+ /**封装请求数据*/
|
|
|
+ K3CloudApiClient client = new K3CloudApiClient(kingdeeConfig.getUrl());
|
|
|
+ try {
|
|
|
+ Boolean result = client.login(kingdeeConfig.getDbId(), kingdeeConfig.getUid(), kingdeeConfig.getPwd(), kingdeeConfig.getLang().intValue());
|
|
|
+ /* String content = "{\"NeedUpDateFields\": []," +
|
|
|
+ " \"NeedReturnFields\": []," +
|
|
|
+ " \"IsDeleteEntry\": \"true\"," +
|
|
|
+ " \"SubSystemId\": \"\"," +
|
|
|
+ " \"IsVerifyBaseDataField\": \"false\"," +
|
|
|
+ " \"IsEntryBatchFill\": \"true\"," +
|
|
|
+ " \"ValidateFlag\": \"true\"," +
|
|
|
+ " \"NumberSearch\": \"true\"," +
|
|
|
+ " \"IsAutoAdjustField\": \"false\"," +
|
|
|
+ " \"InterationFlags\": \"\"," +
|
|
|
+ " \"IgnoreInterationFlag\": \"\"," +
|
|
|
+ " \"Model\": {" +
|
|
|
+ " \"FID\": 0," +
|
|
|
+ " \"FBillType\": {" +
|
|
|
+ " \"FNUMBER\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FDate\": \"1900-01-01\"," +
|
|
|
+ " \"FStockOrgId\": {" +
|
|
|
+ " \"FNumber\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FStockId0\": {" +
|
|
|
+ " \"FNumber\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FPrdOrgId\": {" +
|
|
|
+ " \"FNumber\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FWorkShopId\": {" +
|
|
|
+ " \"FNumber\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FOwnerTypeId0\": \"\"," +
|
|
|
+ " \"FOwnerId0\": {" +
|
|
|
+ " \"FNumber\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FPickerId\": {}," +
|
|
|
+ " \"FSTOCKERID\": {" +
|
|
|
+ " \"FNAME\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FDescription\": \"\"," +
|
|
|
+ " \"FCurrId\": {" +
|
|
|
+ " \"FNumber\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FIsCrossTrade\": \"false\"," +
|
|
|
+ " \"FVmiBusiness\": \"false\"," +
|
|
|
+ " \"FScanBox\": \"\"," +
|
|
|
+ " \"FSourceType\": \"\"," +
|
|
|
+ " \"FIsOwnerTInclOrg\": \"false\"," +
|
|
|
+ " \"F_EMD_Text\": \"\"," +
|
|
|
+ " \"F_EMD_Text1\": \"\"," +
|
|
|
+ " \"F_EMD_Text2\": \"\"," +
|
|
|
+ " \"F_EMD_PrintTimes\": 0," +
|
|
|
+ " \"F_EMD_Qty2\": 0," +
|
|
|
+ " \"F_EMD_Base\": {" +
|
|
|
+ " \"FNUMBER\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FEntity\": [" +
|
|
|
+ " {" +
|
|
|
+ " \"FEntryID\": 0," +
|
|
|
+ " \"FParentMaterialId\": {" +
|
|
|
+ " \"FNumber\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FMoBillNo\": \"\"," +
|
|
|
+ " \"FBaseStockActualQty\": 0," +
|
|
|
+ " \"FFPMBillNo\": \"\"," +
|
|
|
+ " \"FConsome\": \"\"," +
|
|
|
+ " \"FOptQueue\": \"\"," +
|
|
|
+ " \"FReserveType\": \"\"," +
|
|
|
+ " \"FMaterialId\": {" +
|
|
|
+ " \"FNumber\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FUnitID\": {" +
|
|
|
+ " \"FNumber\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FAppQty\": 0," +
|
|
|
+ " \"FActualQty\": 0," +
|
|
|
+ " \"FEntryVmiBusiness\": \"false\"," +
|
|
|
+ " \"FStockId\": {" +
|
|
|
+ " \"FNumber\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FOptPlanBillNo\": \"\"," +
|
|
|
+ " \"FStockLocId\": {}," +
|
|
|
+ " \"FOptPlanBillId\": 0," +
|
|
|
+ " \"FWorkCenterId\": {" +
|
|
|
+ " \"FNUMBER\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FOptDetailId\": 0," +
|
|
|
+ " \"FLot\": {" +
|
|
|
+ " \"FNumber\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FProcessId\": {" +
|
|
|
+ " \"FNumber\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FCobyBomEntryID\": 0," +
|
|
|
+ " \"FBomId\": {" +
|
|
|
+ " \"FNumber\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FGroupRow\": \"\"," +
|
|
|
+ " \"FSrcPickEntryId\": 0," +
|
|
|
+ " \"FSrcBusinessType\": \"\"," +
|
|
|
+ " \"FStockStatusId\": {" +
|
|
|
+ " \"FNumber\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FQueryStockUpdate\": \"\"," +
|
|
|
+ " \"FProduceDate\": \"1900-01-01\"," +
|
|
|
+ " \"FSendRowId\": \"\"," +
|
|
|
+ " \"FEntrtyMemo\": \"\"," +
|
|
|
+ " \"FMtoNo\": \"\"," +
|
|
|
+ " \"FProjectNo\": \"\"," +
|
|
|
+ " \"FMoEntryId\": 0," +
|
|
|
+ " \"FPPBomEntryId\": 0," +
|
|
|
+ " \"FOperId\": 0," +
|
|
|
+ " \"FOwnerTypeId\": \"\"," +
|
|
|
+ " \"FStockUnitId\": {" +
|
|
|
+ " \"FNumber\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FStockAppQty\": 0," +
|
|
|
+ " \"FStockActualQty\": 0," +
|
|
|
+ " \"FStockAllowOverQty\": 0," +
|
|
|
+ " \"FSecUnitId\": {" +
|
|
|
+ " \"FNumber\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FSecActualQty\": 0," +
|
|
|
+ " \"FSecAllowOverQty\": 0," +
|
|
|
+ " \"FMoId\": 0," +
|
|
|
+ " \"FMoEntrySeq\": 0," +
|
|
|
+ " \"FAllowOverQty\": 0," +
|
|
|
+ " \"FPPBomBillNo\": \"\"," +
|
|
|
+ " \"FBaseUnitId\": {" +
|
|
|
+ " \"FNumber\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FBaseAppQty\": 0," +
|
|
|
+ " \"FBaseActualQty\": 0," +
|
|
|
+ " \"FBaseAllowOverQty\": 0," +
|
|
|
+ " \"FEntryWorkShopId\": {" +
|
|
|
+ " \"FNumber\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FKeeperTypeId\": \"\"," +
|
|
|
+ " \"FKeeperId\": {" +
|
|
|
+ " \"FNumber\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FOwnerId\": {" +
|
|
|
+ " \"FNumber\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FExpiryDate\": \"1900-01-01\"," +
|
|
|
+ " \"FSrcBillType\": \"\"," +
|
|
|
+ " \"FSrcBillNo\": \"\"," +
|
|
|
+ " \"FPrice\": 0," +
|
|
|
+ " \"FAmount\": 0," +
|
|
|
+ " \"FEntrySrcInterId\": 0," +
|
|
|
+ " \"FEntrySrcEnteryId\": 0," +
|
|
|
+ " \"FEntrySrcEntrySeq\": 0," +
|
|
|
+ " \"FParentOwnerTypeId\": \"\"," +
|
|
|
+ " \"FParentOwnerId\": {" +
|
|
|
+ " \"FNumber\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FSRCBIZBILLTYPE\": {" +
|
|
|
+ " \"FNAME\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FSRCBIZBILLNO\": \"\"," +
|
|
|
+ " \"FSRCBIZINTERID\": 0," +
|
|
|
+ " \"FSRCBIZENTRYID\": 0," +
|
|
|
+ " \"FSRCBIZENTRYSEQ\": 0," +
|
|
|
+ " \"FPickingStatus\": 0," +
|
|
|
+ " \"F_EMD_Qty\": 0," +
|
|
|
+ " \"F_EMD_Qty1\": 0," +
|
|
|
+ " \"F_EMD_Qty3\": 0," +
|
|
|
+ " \"F_EMD_Qty4\": 0," +
|
|
|
+ " \"F_EMD_Qty5\": 0," +
|
|
|
+ " \"FTransRetFormId\": \"\"," +
|
|
|
+ " \"FTransRetBillNo\": \"\"," +
|
|
|
+ " \"FTransRetId\": 0," +
|
|
|
+ " \"FTransRetEntryId\": 0," +
|
|
|
+ " \"FTransRetEntrySeq\": 0," +
|
|
|
+ " \"FAuxPropId\": {}," +
|
|
|
+ " \"FSerialSubEntity\": [" +
|
|
|
+ " {" +
|
|
|
+ " \"FDetailID\": 0," +
|
|
|
+ " \"FSerialNo\": \"\"," +
|
|
|
+ " \"FSerialId\": {" +
|
|
|
+ " \"FNumber\": \"\"" +
|
|
|
+ " }," +
|
|
|
+ " \"FSerialNote\": \"\"" +
|
|
|
+ " }" +
|
|
|
+ " ]" +
|
|
|
+ " }" +
|
|
|
+ " ]" +
|
|
|
+ " }";*/
|
|
|
+
|
|
|
+ System.out.println("start----"+KingdeeFormId.PICKMTRL.name());
|
|
|
+ List<ProdInoutPickingF> fList = new ArrayList<ProdInoutPickingF>();
|
|
|
+ ProdInoutPickingF prodInoutPickingF= null;
|
|
|
+ for(int i = 1; i< 10 ; i++) {
|
|
|
+ prodInoutPickingF = new ProdInoutPickingF();
|
|
|
+ prodInoutPickingF.setFEntryID(i);
|
|
|
+ fList.add(prodInoutPickingF);
|
|
|
+ }
|
|
|
+ ProdInoutPickingSaveReqModel reqModel = ProdInoutPickingSaveReqModel.builder().FBillType(
|
|
|
+ new FNumberE(" ")
|
|
|
+ ).FDate("2021-08-09").FStockOrgId(new FNumberE("0")).FStockId0(new FNumberE("0")).FEntity(fList).
|
|
|
+ build();
|
|
|
+ CommonSaveReq commonSaveReq = new CommonSaveReq<ProdInoutPickingSaveReqModel>();
|
|
|
+ commonSaveReq.setModel(reqModel);
|
|
|
+ System.out.println(JSONObject.fromObject(commonSaveReq).toString());
|
|
|
+ String Result = client.save(KingdeeFormId.PICKMTRL.getFormId(), JSONObject.fromObject(commonSaveReq).toString());
|
|
|
+ System.out.println(" success:" + Result);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|