Explorar o código

Merge branch 'master' of https://git.steerinfo.com/DAL-DAZHOU/DAL-DAZHOU-AMS-API

luobang %!s(int64=2) %!d(string=hai) anos
pai
achega
ec752f8d99

+ 71 - 0
src/main/java/com/steerinfo/dil/controller/AmsSaleOrderController.java

@@ -1096,6 +1096,7 @@ public class AmsSaleOrderController extends BaseRESTfulController {
         return success(result);
     }
 
+
     /**
      * 修改销售订单中的物资
      *
@@ -1328,6 +1329,76 @@ public class AmsSaleOrderController extends BaseRESTfulController {
         return success(result);
     }
 
+    /**
+     * @author:zyf
+     * @version:1.0
+     * @Date:2022-10-20
+     * @Description:批量关闭分录
+     */
+    @ApiOperation(value = "关闭分录")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "list", value = "批量关闭分录", required = false, dataType = "java.util.List")
+    })
+    @PostMapping(value = "/closingEntries")
+    @Transactional
+    public RESTfulResult closingEntries(@RequestBody List<Map<String, Object>> mapList){
+        if (mapList.isEmpty()){
+            return failed("没有分录数据");
+        }else {
+            try{
+                for (Map<String, Object> map : mapList) {
+                    String reason="关闭每日八点之前的订单";
+                    String number="";
+                    String closeEntryId="";
+                    BigDecimal closeWlEntryId=BigDecimal.ZERO;
+                    if (!("".equals(map.get("number")))&&map.get("number")!=null){
+                        number = (String)map.get("number");
+                    }else {
+                        continue;
+                    }
+                    if (!("".equals(map.get("closeEntryId")))&&map.get("closeEntryId")!=null){
+                        closeEntryId =(String) map.get("closeEntryId");
+                    }else {
+                        continue;
+                    }
+                    if (!("".equals(map.get("saleMaterialId")))&&map.get("saleMaterialId")!=null){
+                        closeWlEntryId=DataChange.dataToBigDecimal(map.get("saleMaterialId"));
+                    }else {
+                        continue;
+                    }
+                    String wholeOrder = "0";
+                    String status = "close";
+                    //需要的数据
+                    Map<String,Object> head = new HashMap<>();
+                    // 销售订单号
+                    head.put("number",number);
+                    // 关闭原因
+                    head.put("reason",reason);
+                    // 金蝶分录
+                    head.put("closeEntryId",closeEntryId);
+                    // 是否整单:(0:分录,1:整单)
+                    head.put("wholeOrder",wholeOrder);
+                    // 物流销售订单分录主键
+                    head.put("closeWlEntryId",closeWlEntryId);
+                    // 状态:close为关闭
+                    head.put("status",status);
+                    Map<String,Object> input = new HashMap<>();
+                    Map<String, Object> totalMap = easUtil.getTotalMap();
+                    input.put("head",head);
+                    totalMap.put("input",input);
+                    // 调用金蝶关闭接口
+                    String json = JSONUtils.toJSONString(totalMap);
+                    System.out.println(json);
+                    Map<String,Object> resultMap = joinFeign.deleteSaleOrderToEas(totalMap);
+                    System.out.println(resultMap);
+                }
+            }catch (Exception e){
+                System.out.println("e"+e.getMessage());
+            }
+        }
+        return success("分录成功删除");
+    }
+
     @ApiModelProperty(value = "展示已审核化产焦炭销售订单列表")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),