Browse Source

Merge remote-tracking branch 'origin/master'

“lqy 1 month ago
parent
commit
7cdf93a0aa

+ 1 - 1
mjava-huagao/src/main/java/com/malk/huagao/schedule/YdScheduleTask.java

@@ -144,7 +144,7 @@ private YdHuaGaoService ydHuaGaoService;
         }
     }
 
-    @Scheduled(cron = "0 0/5 * * * ?")
+//    @Scheduled(cron = "0 0/5 * * * ?")
     public void synckdYdMaterial() {
         log.info("定时同步-物料信息");
         try {

+ 26 - 4
mjava-huagao/src/main/java/com/malk/huagao/service/impl/KdHuaGaoServiceImpl.java

@@ -106,6 +106,7 @@ public class KdHuaGaoServiceImpl implements KdHuaGaoService {
                             .formInstanceIdList(formInstanceIdList)
                             .build(), YDConf.FORM_OPERATION.delete_batch);
                 }
+                Thread.sleep(1000);
             }
             log.info("删除序列号主档数据完成:{}年,{}月,{}周",year,month,weekOfMonth);
 
@@ -277,7 +278,7 @@ public class KdHuaGaoServiceImpl implements KdHuaGaoService {
                         .build(), YDConf.FORM_OPERATION.create);
             }
         }catch (Exception e){
-            fail(e.getMessage());
+            throw new RuntimeException(e);
         }
 
     }
@@ -321,6 +322,7 @@ public class KdHuaGaoServiceImpl implements KdHuaGaoService {
                             .formInstanceIdList(formInstanceIdList)
                             .build(), YDConf.FORM_OPERATION.delete_batch);
                 }
+                Thread.sleep(1000);
             }
             log.info("删除即时库存数据完成:{}年,{}月,{}周",year,month,weekOfMonth);
 
@@ -476,7 +478,7 @@ public class KdHuaGaoServiceImpl implements KdHuaGaoService {
             }
 
         }catch (Exception e){
-            fail(e.getMessage());
+            throw new RuntimeException(e);
         }
 
     }
@@ -513,7 +515,7 @@ public class KdHuaGaoServiceImpl implements KdHuaGaoService {
             try {
                 result = (List<Map>)JSONObject.parse(client.billQuery(JSONObject.toJSONString(billQuery)));
             } catch (Exception e) {
-                fail(e.getMessage());
+                throw new RuntimeException(e);
             }
 
             list.addAll(result);
@@ -565,6 +567,14 @@ public class KdHuaGaoServiceImpl implements KdHuaGaoService {
     @Async
     @Override
     public void syncReport(String type,String userId) {
+        MDC.put("MDC_KEY_PID","1002");
+
+        //创建看板更新记录
+        String formInstId = ydClient.operateData(YDParam.builder()
+                .formUuid("FORM-0BEA655A36724D509A2CF21C4BA38D367YF7")
+                .formDataJson(JSONObject.toJSONString(UtilMap.map("selectField_mfmhvkey, selectField_mhsjnn2r, dateField_mhsjnn2s, employeeField_mhswy0xy", type, "更新中", System.currentTimeMillis(),Arrays.asList(userId))))
+                .build(), YDConf.FORM_OPERATION.create).toString();
+
         try {
             switch (type){
                 case "成品库存天数看板": syncBDSerialMainFile();break;
@@ -573,16 +583,28 @@ public class KdHuaGaoServiceImpl implements KdHuaGaoService {
                 case "成品/样机出库看板": syncDLVNotice();break;
                 default:break;
             }
+
             //发送工作通知
             if (Objects.nonNull(userId)){
                 sendDdMsg(ddClient.getAccessToken(),ddConf.getAgentId(),userId,"更新" + type + "完成  时间:" + DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
             }
 
+            //更新看板更新记录
+            ydClient.operateData(YDParam.builder()
+                    .formInstId(formInstId)
+                    .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("selectField_mhsjnn2r, dateField_mhsjnn2t", "已完成", System.currentTimeMillis())))
+                    .build(), YDConf.FORM_OPERATION.update);
         }catch (Exception e){
             //发送工作通知
             if (Objects.nonNull(userId)){
                 sendDdMsg(ddClient.getAccessToken(),ddConf.getAgentId(),userId,"更新" + type + "异常:" + e.getMessage() + "  时间:" + DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
             }
+
+            //更新看板更新记录
+            ydClient.operateData(YDParam.builder()
+                    .formInstId(formInstId)
+                    .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("selectField_mhsjnn2r, dateField_mhsjnn2t", "异常", System.currentTimeMillis())))
+                    .build(), YDConf.FORM_OPERATION.update);
         }
     }
 
@@ -729,7 +751,7 @@ public class KdHuaGaoServiceImpl implements KdHuaGaoService {
             try {
                 result = (List<Map>)JSONObject.parse(client.billQuery(JSONObject.toJSONString(billQuery)));
             } catch (Exception e) {
-                fail(e.getMessage());
+                throw new RuntimeException(e);
             }
 
             list.addAll(result);

+ 5 - 0
mjava-huagao/src/test/java/com/malk/huagao/KdTest.java

@@ -200,6 +200,11 @@ public class KdTest {
         kdHuaGaoService.syncDLVNotice();
     }
 
+    @Test
+    public void test8(){
+        kdHuaGaoService.syncReport("成品/样机出库看板","344749020127590108");
+    }
+
     private IdentifyInfo initIden(){
         //注意 1:此处不再使用参数形式传入用户名及密码等敏感信息,改为在登录配置文件中设置。
         //注意 2:必须先配置第三方系统登录授权信息后,再进行业务操作,详情参考各语言版本SDK介绍中的登录配置文件说明。

+ 16 - 3
mjava-jinlun/src/main/java/com/malk/jinlun/service/impl/JinlunTaskServiceImpl.java

@@ -150,7 +150,7 @@ public class JinlunTaskServiceImpl implements JinlunTaskService {
 
         BillQuery billQuery = new BillQuery();
         billQuery.setFormId("SAL_OUTSTOCK");
-        billQuery.setFieldKeys("FBillNo,FBillTypeID.FName,FDate,FSettleCurrID.FName,FCustomerID.FName,FCustomerID.FShortName,FHeadLocationID.FName,FMaterialID.FNumber,FMaterialID.FName,FMaterialID.FSpecification,FMaterialID.F_Sl_ducengid,F_VMKV_Text_WLZT,FPriceUnitQty,FRealQty,FPriceUnitId.FName,FBaseUnitID.FName,FIsFree,FPrice,FTaxPrice,FEntryTaxRate,FAmount,FAllAmount,FDiscount,FEntrynote");
+        billQuery.setFieldKeys("FBillNo,FBillTypeID.FName,FDate,FSettleCurrID.FName,FCustomerID.FName,FCustomerID.FShortName,FHeadLocationID.FName,FMaterialID.FNumber,FMaterialID.FName,FMaterialID.FSpecification,FMaterialID.F_Sl_ducengid,F_VMKV_Text_WLZT,FPriceUnitQty,FRealQty,FUnitID.FName,FPriceUnitId.FName,FAuxUnitID.FName,FAuxUnitQty,FIsFree,FPrice,FTaxPrice,FEntryTaxRate,FAmount,FAllAmount,FDiscount,FEntrynote");
         List<Map> filterString = new ArrayList<>();
 
         //审核日期为昨天至今天
@@ -201,9 +201,14 @@ public class JinlunTaskServiceImpl implements JinlunTaskService {
             entryMap.put("Text1762245901183",UtilMap.getString(saleOut,"F_VMKV_Text_WLZT"));//物料状态
 
             entryMap.put("Number1760153811668",UtilMap.getDouble(saleOut,"FPriceUnitQty"));//计价数量
-            entryMap.put("Number1760153958907",UtilMap.getDouble(saleOut,"FRealQty"));//实发数量
+            Double sfsl = UtilMap.getDouble(saleOut, "FRealQty");
+            entryMap.put("Number1760153958907", sfsl);//实发数量
             entryMap.put("Text1760153793403",UtilMap.getString(saleOut,"FPriceUnitId.FName"));//计价单位
-            entryMap.put("Text1760153804514",UtilMap.getString(saleOut,"FBaseUnitID.FName"));//基本单位
+            String kcdw = UtilMap.getString(saleOut, "FUnitID.FName");
+            entryMap.put("ShortText1762508609328", kcdw);//库存单位
+            entryMap.put("Text1762508629987",UtilMap.getString(saleOut,"FAuxUnitID.FName"));//库存辅单位
+            Double kcfdwsl = UtilMap.getDouble(saleOut, "FAuxUnitQty");
+            entryMap.put("Number1762508641763", kcfdwsl);//库存辅单位数量
             entryMap.put("Logic1760171983887",UtilMap.getBoolean(saleOut,"FIsFree"));//是否赠品
             entryMap.put("Number1760153991898",UtilMap.getDouble(saleOut,"FPrice"));//单价
             entryMap.put("Number1760154006703",UtilMap.getDouble(saleOut,"FTaxPrice"));//计价单价
@@ -213,6 +218,14 @@ public class JinlunTaskServiceImpl implements JinlunTaskService {
             entryMap.put("Number1760154058940",UtilMap.getDouble(saleOut,"FDiscount"));//折扣额
             entryMap.put("ShortText1760154066042",UtilMap.getString(saleOut,"FEntrynote"));//备注
 
+            if ("Pcs".equals(kcdw)){
+                entryMap.put("Number1762509492431",sfsl);//数量
+                entryMap.put("Number1762509515885",kcfdwsl);//重量
+            }else {
+                entryMap.put("Number1762509492431",0);//数量
+                entryMap.put("Number1762509515885",sfsl);//重量
+            }
+
             entry.add(entryMap);
 
             data.put("Sheet1760153734916",entry);