Browse Source

完善仓库

hfxc226 2 years ago
parent
commit
6b528106f5

+ 7 - 3
platform-common/src/main/java/com/platform/common/util/DateUtils.java

@@ -466,8 +466,10 @@ public class DateUtils {
 
     public static void main(String[] args) {
         Calendar calendar = Calendar.getInstance();
-        calendar.set(2022,11-2,1,0,2, 30);
+        calendar.set(2022, 11 - 2, 1, 0, 2, 30);
         getLastMonth(calendar);
+        LocalDate localDate = LocalDate.now();
+        System.out.println(DateUtils.dateToString(localDate, DateUtils.PATTERN_YMD) + " 00:00:00");
     }
 
     /**
@@ -640,9 +642,10 @@ public class DateUtils {
 
     /**
      * 获取前一天时间
+     *
      * @param calendar
      */
-    public static void getLastDay(Calendar calendar){
+    public static void getLastDay(Calendar calendar) {
         calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH) - 1);
         SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         System.out.println("一个小时前的时间:" + df.format(calendar.getTime()));
@@ -650,9 +653,10 @@ public class DateUtils {
 
     /**
      * 获取上个月时间
+     *
      * @param calendar
      */
-    public static void getLastMonth(Calendar calendar){
+    public static void getLastMonth(Calendar calendar) {
         calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) - 1);
         SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         System.out.println("上个月的时间:" + df.format(calendar.getTime()));

+ 1 - 0
platform-dao/src/main/java/com/platform/dao/dto/store/OutStoreDetailDTO.java

@@ -24,6 +24,7 @@ import java.time.LocalDate;
 @EqualsAndHashCode(callSuper = true)
 public class OutStoreDetailDTO extends BaseDTO implements Serializable {
 
+    private Integer autoId;
     /**
      * 使用公司
      */

+ 1 - 0
platform-dao/src/main/java/com/platform/dao/dto/store/OutStoreFormDTO.java

@@ -24,6 +24,7 @@ import java.util.List;
 @Accessors(chain = true)
 @EqualsAndHashCode(callSuper = true)
 public class OutStoreFormDTO extends BaseDTO implements Serializable {
+    private String yyMessage;
     /**
      * 工作流实例ID
      */

+ 1 - 0
platform-dao/src/main/java/com/platform/dao/entity/store/OutStoreDetail.java

@@ -23,6 +23,7 @@ import javax.persistence.Transient;
 @Table(name = "t_out_store_detail")
 public class OutStoreDetail implements Serializable{
 
+    private Integer autoId;
     /**
      * 主键
      */

+ 1 - 0
platform-dao/src/main/java/com/platform/dao/entity/store/OutStoreForm.java

@@ -22,6 +22,7 @@ import javax.persistence.Transient;
 @Accessors(chain = true)
 @Table(name = "t_out_store_form")
 public class OutStoreForm implements Serializable{
+    private String yyMessage;
     /**
      * 工作流实例ID
      */

+ 10 - 2
platform-dao/src/main/java/com/platform/dao/enums/OutStoreStatusEnum.java

@@ -21,13 +21,21 @@ public enum OutStoreStatusEnum {
      */
     NOT_EXECUTE(1),
     /**
-     * 主管审核通过:自动提交到用友审核:待仓库出库
+     * 主管审核通过:等待推送到用友
      */
     EXECUTING(2),
+    /**
+     * 推送失败:
+     */
+    PUSH_ERROR(3),
+    /**
+     * 推送成功
+     */
+    PUSH_OK(4),
     /**
      * 已完成
      */
-    FINISH(3);
+    FINISH(5);
     private final Integer value;
 
 }

+ 1 - 0
platform-dao/src/main/java/com/platform/dao/vo/query/store/OutStoreDetailVO.java

@@ -26,6 +26,7 @@ import java.util.List;
 @EqualsAndHashCode(callSuper = true)
 public class OutStoreDetailVO extends BaseVO implements Serializable {
 
+    private Integer autoId;
     /**
      * 主键
      */

+ 1 - 0
platform-dao/src/main/java/com/platform/dao/vo/query/store/OutStoreFormVO.java

@@ -25,6 +25,7 @@ import java.util.List;
 @Accessors(chain = true)
 @EqualsAndHashCode(callSuper = true)
 public class OutStoreFormVO extends BaseVO implements Serializable {
+    private String yyMessage;
     private Integer roleFlag;
     /**
      * 工作流实例ID

+ 1 - 0
platform-dao/src/main/java/com/platform/dao/vo/query/store/SpareStoreVO.java

@@ -157,4 +157,5 @@ public class SpareStoreVO extends BaseVO implements Serializable {
     private String unit;
 
     private String cBatch; ;// 批号
+    private Integer autoId; ;// 库存唯一编码
 }

+ 8 - 2
platform-dao/src/main/resources/mapper/store/OutStoreDetailMapper.xml

@@ -10,7 +10,7 @@
                                      outstoredetail.no,
                                      outstoredetail.ggxh,
                                      outstoredetail.real_num,
-                                     outstoredetail.yy_id,
+                                     outstoredetail.yy_id,outstoredetail.auto_id,
                                      outstoredetail.is_out,
 outstoredetail.c_batch,
                                      outstoredetail.store_name,
@@ -36,7 +36,7 @@ outstoredetail.c_batch,
                                      outstoredetail.spare_id,
 outstoredetail.c_batch,
                                      outstoredetail.real_num,
-                                     outstoredetail.yy_id,
+                                     outstoredetail.yy_id,outstoredetail.auto_id,
                                      outstoredetail.is_out,
                                      outstoredetail.store_name,
                                      outstoredetail.spare_name,
@@ -51,6 +51,12 @@ outstoredetail.c_batch,
         <if test="outId != null and outId != ''">
             and outstoredetail.out_id = #{outId}
         </if>
+        <if test="yyId != null and yyId != ''">
+            and outstoredetail.yy_id = #{yyId}
+        </if>
+        <if test="autoId != null and autoId != ''">
+            and outstoredetail.auto_id = #{autoId}
+        </if>
         <if test="isOut != null and isOut != ''">
             and outstoredetail.is_out = #{isOut}
         </if>

+ 2 - 0
platform-dao/src/main/resources/mapper/store/OutStoreFormMapper.xml

@@ -10,6 +10,7 @@
                                      outstoreform.out_no,
                                      outstoreform.type,
                                      outstoreform.yy_id,
+                                     outstoreform.yy_message,
                                      outstoreform.pick_id,
                                      outstoreform.pick_no,
 outstoreform.process_instance_id,
@@ -34,6 +35,7 @@ outstoreform.process_instance_id,
                                       outstoreform.total_price,
                                        outstoreform.status,
                                      outstoreform.yy_id,
+                                     outstoreform.yy_message,
                                       outstoreform.type,
                                       outstoreform.store_id,
                                      outstoreform.pick_id,

+ 1 - 2
platform-service/src/main/java/com/platform/service/business/impl/OutStoreFormActivitiServiceImpl.java

@@ -113,6 +113,7 @@ public class OutStoreFormActivitiServiceImpl extends BaseFormCheckServiceAbstrac
         outStoreForm.setStatus(OutStoreStatusEnum.EXECUTING.getValue());
         outStoreFormMapper.updateByPrimaryKeySelective(outStoreForm);
         //yongyouService.addOutForm(actAuditRequest.getId());
+        // Thread.sleep(5000);// 5秒后执行
         YongYouThread yongYouThread = new YongYouThread();
         yongYouThread.setId(actAuditRequest.getId());
         yongYouThread.start();
@@ -121,11 +122,9 @@ public class OutStoreFormActivitiServiceImpl extends BaseFormCheckServiceAbstrac
 
     class YongYouThread extends Thread {
         private String id;
-
         public void setId(String id){
             this.id = id;
         }
-
         @Override
         public void run() {
             yongyouService.addOutForm(id);

+ 7 - 1
platform-service/src/main/java/com/platform/service/store/OutStoreFormService.java

@@ -75,7 +75,13 @@ public interface OutStoreFormService extends IBaseService<OutStoreForm, OutStore
     OutStoreForm saveModelByDTOYY(OutStoreFormDTO outStoreFormDTO);
 
     /**
-     * 提交领用申请,生成待审批的出库单
+     * 推送失败
+     *
+     * @param id
+     **/
+    void updateModelByIdYongyouError(String id, String yyMessage);
+    /**
+     * 推送成功,生成待审批的出库单
      *
      * @param id
      * @param yyId

+ 26 - 3
platform-service/src/main/java/com/platform/service/store/impl/OutStoreFormServiceImpl.java

@@ -777,16 +777,39 @@ public class OutStoreFormServiceImpl extends BaseServiceImpl<OutStoreFormMapper,
         return price;
     }
 
+    /**
+     * 成功推送到用友
+     * @param id
+     * @param yyMessage
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void updateModelByIdYongyouError(String id, String yyMessage) {
+        OutStoreForm outStoreForm = new OutStoreForm();
+        outStoreForm.setId(id);
+        outStoreForm.setStatus(OutStoreStatusEnum.PUSH_ERROR.getValue());
+        outStoreForm.setYyMessage(yyMessage);
+        outStoreForm.setUpdateTime(LocalDateTime.now());
+        // outStoreForm.setUpdateUserId(SecurityUtils.getUserInfo().getUserId());
+        // outStoreForm.setUpdateUserName(SecurityUtils.getUserInfo().getRealName());
+        mapper.updateByPrimaryKeySelective(outStoreForm);
+    }
+
+    /**
+     * 成功推送到用友
+     * @param id
+     * @param yyId
+     */
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void updateModelByIdYongyou(String id, String yyId) {
         OutStoreForm outStoreForm = new OutStoreForm();
         outStoreForm.setId(id);
         outStoreForm.setYyId(yyId);
-        outStoreForm.setStatus(OutStoreStatusEnum.EXECUTING.getValue());
+        outStoreForm.setStatus(OutStoreStatusEnum.PUSH_OK.getValue());
         outStoreForm.setUpdateTime(LocalDateTime.now());
-        outStoreForm.setUpdateUserId(SecurityUtils.getUserInfo().getUserId());
-        outStoreForm.setUpdateUserName(SecurityUtils.getUserInfo().getRealName());
+        // outStoreForm.setUpdateUserId(SecurityUtils.getUserInfo().getUserId());
+        // outStoreForm.setUpdateUserName(SecurityUtils.getUserInfo().getRealName());
         mapper.updateByPrimaryKeySelective(outStoreForm);
     }
 }

+ 1 - 1
platform-service/src/main/java/com/platform/service/yongyou/YongyouService.java

@@ -53,7 +53,7 @@ public interface YongyouService {
     /**
      * 出库单(退库单)用友回调
      *
-     * @param jsonStr
+     * @param jsonObject
      * @return
      */
     void backOutForm(JSONObject jsonObject);

+ 4 - 2
platform-service/src/main/java/com/platform/service/yongyou/impl/YongyouServiceImpl.java

@@ -174,6 +174,7 @@ public class YongyouServiceImpl implements YongyouService {
             partInfoVO.setStoreId(stockResponse.getCWhCode());
             partInfoVO.setUnit(stockResponse.getCComUnitName());
             partInfoVO.setCBatch(stockResponse.getCBatch());
+            partInfoVO.setAutoId(stockResponse.getAutoId());
             partInfoVOS.add(partInfoVO);
         }
 
@@ -190,7 +191,7 @@ public class YongyouServiceImpl implements YongyouService {
     }
 
     /**
-     * 查询存量分页
+     * 查询物资分页
      *
      * @param record
      * @param pageNum
@@ -269,7 +270,7 @@ public class YongyouServiceImpl implements YongyouService {
         otherOutMain.setCvouchtype("09");
         otherOutMain.setCbustype("其他出库");
         otherOutMain.setCwhcode(outStoreFormVO.getStoreId());
-        otherOutMain.setDdate(DateUtils.dateToString(outStoreFormVO.getUserTime(), DateUtils.PATTERN_YMD_HMS));
+        otherOutMain.setDdate(DateUtils.dateToString(outStoreFormVO.getUserTime(), DateUtils.PATTERN_YMD) + " 00:00:00");
         otherOutMain.setVt_id("85");
         otherOutMain.setBisstqc(false);
         otherOutMain.setCcode("0000000006");
@@ -306,6 +307,7 @@ public class YongyouServiceImpl implements YongyouService {
         String responseStr = handler.handler();
         OtherOutAddResponse response = JSONObject.parseObject(responseStr, OtherOutAddResponse.class);
         if(!response.getResult()){
+            outStoreFormService.updateModelByIdYongyouError(outStoreFormVO.getId(), response.getMsg());
             throw new BusinessException(response.getMsg());
         }
         String data = response.getData();