Pārlūkot izejas kodu

完成出货通知单

523096025 2 mēneši atpakaļ
vecāks
revīzija
61c65a2a8f

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/base/controller/ProductionRecordController.java

@@ -90,7 +90,7 @@ public class ProductionRecordController {
         wrapper.ge(StringUtils.isNotEmpty(productionPlanParam.getLevelstart()),"grade",productionPlanParam.getLevelstart());
         wrapper.le(StringUtils.isNotEmpty(productionPlanParam.getLevelEnd()),"grade",productionPlanParam.getLevelEnd());
         wrapper.like(StringUtils.isNotEmpty(productionPlanParam.getPigBatch()),"getPig_batch",productionPlanParam.getPigBatch());
-        wrapper.like(StringUtils.isNotEmpty(productionPlanParam.getProcessType()),"process_type",productionPlanParam.getProcessType());
+        wrapper.like(StringUtils.isNotEmpty(productionPlanParam.getProcessType()),"processing_type",productionPlanParam.getProcessType());
         wrapper.le(StringUtils.isNotEmpty(productionPlanParam.getRecordDateEnd()),"production_record_date",productionPlanParam.getRecordDateEnd());
         wrapper.ge(StringUtils.isNotEmpty(productionPlanParam.getRecordDatestart()),"production_record_date",productionPlanParam.getRecordDatestart());
         wrapper.like(StringUtils.isNotEmpty(productionPlanParam.getVariety()),"variety",productionPlanParam.getVariety());

+ 1 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/base/controller/ProductionRegularController.java

@@ -100,6 +100,7 @@ public class ProductionRegularController {
         regular.setCreateBy(getUsername());
         ProductionRecord productionRecord = new ProductionRecord();
         BeanUtil.copyProperties(regular, productionRecord);
+        productionRecord.setProductionRecordDate(regular.getProductionDate());
         productionRecordService.save(productionRecord);
         return success(productionRegularService.save(regular));
     }

+ 52 - 41
ruoyi-admin/src/main/java/com/ruoyi/web/base/controller/ProductionShipmentNotificationController.java

@@ -59,35 +59,21 @@ public class ProductionShipmentNotificationController {
         return success();
     }
 
-    @ApiOperation("出货通知列表")
-    @PostMapping("/list")
-    public AjaxResult listAll(  @RequestBody ProductionRegularPlanRequest planRequest,HttpServletRequest request) {
-        String productionType = planRequest.getProductionType();
-        QueryWrapper<ProductionShipmentNotification> wrapper = new QueryWrapper<ProductionShipmentNotification>()
-                .eq("org_id", tokenService.getLoginOrgId(request));
-        if (StringUtils.isNotEmpty(productionType)){
-            wrapper.in("a.product_type", Arrays.asList(productionType.split(",")));
-        }
-        wrapper.eq(StringUtils.isNotEmpty(planRequest.getDeliveryDate()),"a.delivery_date",planRequest.getDeliveryDate());
-        List<ProductionShipmentNotification> list = productionShipmentNotificationService.list(wrapper);
 
 
-        return success();
-    }
-
     @ApiOperation("出货通知列表")
     @PostMapping("/listTree")
     public AjaxResult listTree(  @RequestBody ProductionRegularPlanRequest planRequest,HttpServletRequest request) {
-        String productionType = planRequest.getProductionType();
+        String productionTypes = planRequest.getProductTypes();
         QueryWrapper<ProductionShipmentNotification> wrapper = new QueryWrapper<ProductionShipmentNotification>()
-                .eq("org_id", tokenService.getLoginOrgId(request));
-        if (StringUtils.isNotEmpty(productionType)){
-            wrapper.in("a.product_type", Arrays.asList(productionType.split(",")));
+                .eq("a.org_id", tokenService.getLoginOrgId(request));
+        if (StringUtils.isNotEmpty(productionTypes)){
+            wrapper.in("a.product_num", Arrays.asList(productionTypes.split(",")));
         }
         wrapper.eq(StringUtils.isNotEmpty(planRequest.getDeliveryDate()),"a.delivery_date",planRequest.getDeliveryDate());
         List<ProductionRegularPlanParam> listTree = productionShipmentNotificationService.listTree(wrapper);
 
-
+        System.out.println(listTree.toString());
         return success( buildTree(listTree));
     }
     public static void main(String[] args) {
@@ -126,42 +112,48 @@ public class ProductionShipmentNotificationController {
                     lineNode.addChild(marketNode);
 
                 }
-                // 创建customer节点并添加到market节点
-                TreeNode customerNode = new TreeNode(TreeNode.NodeType.CUSTOMER,
-                        data.getCustomerNum(), data.getCustomer());
-                marketNode.addChild(customerNode);
-            }
 
-            // 第二步:向上收集customerNum
-            for (TreeNode lineNode : lineNodeMap.values()) {
-                for (TreeNode marketNode : lineNode.getChildren()) {
-                    for (TreeNode customerNode : marketNode.getChildren()) {
-                        customerNode.addCustomerNum(customerNode.getNum());
-                        // 收集market节点的customerNum
-                        marketNode.getAllCustomerNums().add(customerNode.getNum());
-                    }
-
-                    // 收集line节点的customerNum
-                    lineNode.getAllCustomerNums().addAll(marketNode.getAllCustomerNums());
+
+                if (!marketNode.getAllCustomerNums().contains(data.getCustomerNum())) {
+                    TreeNode customerNode = new TreeNode(TreeNode.NodeType.CUSTOMER,
+                            data.getCustomerNum(), data.getCustomer());
+                    marketNode.addChild(customerNode);
+                    customerNode.addCustomerNum(data.getCustomerNum());
                 }
+                marketNode.addCustomerNum(data.getCustomerNum());
+                lineNode.addCustomerNum(data.getCustomerNum());
             }
 
+
+//            for (TreeNode lineNode : lineNodeMap.values()) {
+//                for (TreeNode marketNode : lineNode.getChildren()) {
+//                    for (TreeNode customerNode : marketNode.getChildren()) {
+//                        customerNode.addCustomerNum(customerNode.getNum());
+//                        // 收集market节点的customerNum
+//                        marketNode.getAllCustomerNums().add(customerNode.getNum());
+//                    }
+//
+//                    // 收集line节点的customerNum
+//                    lineNode.getAllCustomerNums().addAll(marketNode.getAllCustomerNums());
+//                }
+//            }
+
             return new ArrayList<>(lineNodeMap.values());
         }
 
 
     @ApiOperation("出货通知分页")
-    @GetMapping("/page")
+    @PostMapping("/page")
     public AjaxResult page(
             @RequestBody ProductionRegularPlanRequest planRequest,
             HttpServletRequest request
     ) {
-        String productionType = planRequest.getProductionType();
+        String productionTypes = planRequest.getProductTypes();
         String customerNums = planRequest.getCustomerNums();
         QueryWrapper<ProductionShipmentNotification> wrapper = new QueryWrapper<ProductionShipmentNotification>()
                 .eq("org_id", tokenService.getLoginOrgId(request));
-        if (StringUtils.isNotEmpty(productionType)){
-            wrapper.in("product_type", Arrays.asList(productionType.split(",")));
+        if (StringUtils.isNotEmpty(productionTypes)){
+            wrapper.in("product_type", Arrays.asList(productionTypes.split(",")));
         }
         if (StringUtils.isNotEmpty(customerNums)){
             wrapper.in("customer_number", Arrays.asList(customerNums.split(",")));
@@ -170,8 +162,27 @@ public class ProductionShipmentNotificationController {
         wrapper.eq(StringUtils.isNotEmpty(planRequest.getDeliveryDate()),"delivery_date",planRequest.getDeliveryDate());
 
 
-        productionShipmentNotificationService.page(new Page<>(planRequest.getPageNum(),planRequest.getPageSize()),wrapper);
-        return success();
+
+        return success( productionShipmentNotificationService.page(new Page<>(planRequest.getPageNum(),planRequest.getPageSize()),wrapper));
+    }
+    @ApiOperation("出货通知列表")
+    @PostMapping("/list")
+    public AjaxResult listAll(  @RequestBody ProductionRegularPlanRequest planRequest,HttpServletRequest request) {
+        String productionTypes = planRequest.getProductTypes();
+        String customerNums = planRequest.getCustomerNums();
+        QueryWrapper<ProductionShipmentNotification> wrapper = new QueryWrapper<ProductionShipmentNotification>()
+                .eq("org_id", tokenService.getLoginOrgId(request));
+        if (StringUtils.isNotEmpty(productionTypes)){
+            wrapper.in("product_type", Arrays.asList(productionTypes.split(",")));
+        }
+        if (StringUtils.isNotEmpty(customerNums)){
+            wrapper.in("customer_number", Arrays.asList(customerNums.split(",")));
+        }
+
+        wrapper.eq(StringUtils.isNotEmpty(planRequest.getDeliveryDate()),"delivery_date",planRequest.getDeliveryDate());
+
+
+        return success( productionShipmentNotificationService.list(wrapper));
     }
 
     @ApiOperation("出货通知详情")

+ 32 - 9
ruoyi-admin/src/main/java/com/ruoyi/web/base/controller/ProductionWhiteStripAllocationController.java

@@ -1,6 +1,8 @@
 package com.ruoyi.web.base.controller;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.ruoyi.common.core.domain.AjaxResult;
@@ -10,6 +12,8 @@ import com.ruoyi.web.base.domain.*;
 import com.ruoyi.web.base.domain.param.WiteStripAllRequest;
 import com.ruoyi.web.base.service.*;
 import com.ruoyi.web.sales.domain.SalesOrder;
+import com.ruoyi.web.sales.domain.SalesOrderGoods;
+import com.ruoyi.web.sales.service.ISalesOrderGoodsService;
 import com.ruoyi.web.sales.service.ISalesOrderService;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -17,6 +21,7 @@ import org.springframework.security.core.parameters.P;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.List;
 import java.util.Map;
 
 import static com.ruoyi.common.core.domain.AjaxResult.success;
@@ -37,7 +42,9 @@ public class ProductionWhiteStripAllocationController {
     @Autowired
     private TokenService tokenService;
     @Autowired
-    private ISalesOrderService salesOrderService;
+     private ISalesOrderService salesOrderService;
+    @Autowired
+    private ISalesOrderGoodsService salesOrderGoodsService;
 
     @ApiOperation("白条分配添加")
     @PostMapping("/add")
@@ -156,27 +163,43 @@ public class ProductionWhiteStripAllocationController {
             productionWhiteStripAllocation.setId(Integer.parseInt(id));
             productionWhiteStripAllocation.setCompletionStatus(1);
             productionWhiteStripAllocationService.updateById(productionWhiteStripAllocation);
-            saveShipmentNotification(id);
+            ProductionWhiteStripAllocation byId = productionWhiteStripAllocationService.getById(id);
+            saveShipmentNotification(byId);
         }
         return success();
     }
 
-    private void saveShipmentNotification(String id) {
+    private void saveShipmentNotification(ProductionWhiteStripAllocation byId) {
 
         ProductionShipmentNotification productionShipmentNotification = new ProductionShipmentNotification();
-        ProductionWhiteStripAllocation byId = productionWhiteStripAllocationService.getById(id);
-        SalesOrder salesOrder = salesOrderService.getById(byId.getSaleId());
+
+        SalesOrderGoods salesOrder = salesOrderGoodsService.getById(byId.getSaleId());
 
         BeanUtil.copyProperties(byId,productionShipmentNotification);
-        productionShipmentNotification.setAmount(salesOrder.getTotalAmount()) ;
-        productionShipmentNotification.setUnitPrice(salesOrder.getGoods().get(0).getUnitPrice()) ;
-        productionShipmentNotification.setReceivableCustomer(salesOrder.getReceivableCustomer()) ;
+        productionShipmentNotification.setAmount(salesOrder.getSubTotal()) ;
+        productionShipmentNotification.setUnitPrice(salesOrder.getUnitPrice()) ;
+
+
         BaseMaterial material = baseMaterialService.getOne(new QueryWrapper<BaseMaterial>().eq("goods_num", byId.getMaterialCode()));
         productionShipmentNotification.setProductType(material.getProductTypeName()) ;
+        productionShipmentNotification.setProductNum(material.getProductType());
+        productionShipmentNotification.setMaterialName(material.getGoodsName());
+        productionShipmentNotification.setBaseNum(salesOrder.getBaseNum());
+        productionShipmentNotification.setUnit(salesOrder.getBaseUnit());
+        productionShipmentNotification.setAssNum(salesOrder.getAssNum());
+        productionShipmentNotification.setAuxiliaryUnit(salesOrder.getAssUnit());
 //        productionShipmentNotification.setTotalDeduction(salesOrder.getReceivableCustomer()) ;
 //        productionShipmentNotification.setCustomerChannel(salesOrder.getc()) ;
         productionShipmentNotification.setWarehouse(material.getWarehouseName()) ;
-        productionShipmentNotification.setCustomerNumber(salesOrder.getCustomerNum()) ;
+        List<SalesOrder> salesOrders = salesOrderService.list(new QueryWrapper<SalesOrder>().eq("order_num", salesOrder.getOrderNum()));
+        if(ObjectUtil.isNotEmpty(salesOrders)){
+            productionShipmentNotification.setReceivableCustomer(salesOrders.get(0).getCustomerName()) ;
+            productionShipmentNotification.setCustomer(salesOrders.get(0).getCustomerName()) ;
+            productionShipmentNotification.setCustomerNumber(salesOrders.get(0).getCustomerNum()) ;
+
+        }
+
+
         productionShipmentNotification.setSalesWeight(byId.getWeight()) ;
 //        productionShipmentNotification.setSalesDeductionPercentage(salesOrder.getReceivableCustomer()) ;
 

+ 1 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/base/domain/ProductionRecord.java

@@ -52,6 +52,7 @@ public class ProductionRecord  extends Base {
     @ApiModelProperty(value = "品种")
     private String variety;
 
+
     @ApiModelProperty(value = "动物标识")
     private String animalIdentification;
 

+ 5 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/base/domain/ProductionRegular.java

@@ -8,7 +8,9 @@ import java.time.LocalDateTime;
 import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.TableField;
 import java.io.Serializable;
+import java.util.Date;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.ruoyi.web.base.domain.base.Base;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -59,7 +61,8 @@ public class ProductionRegular  extends Base {
     private String productionRecordNumber;
 
     @ApiModelProperty(value = "生产日期")
-    private LocalDate productionDate;
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date productionDate;
 
     @ApiModelProperty(value = "品种")
     private String variety;
@@ -105,7 +108,7 @@ public class ProductionRegular  extends Base {
 
     @ApiModelProperty(value = "扣重比例")
     private String deductionRatio;
-   @TableField(exist =  false)
+      @TableField(exist =  false)
     private int qualityInspectionResult;
     private int isFenge;
     private int isFenpei;

+ 2 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/base/domain/ProductionShipmentNotification.java

@@ -56,7 +56,7 @@ public class ProductionShipmentNotification  extends Base {
     private String unit;
 
     @ApiModelProperty(value = "辅助数量")
-    private Integer assNum;
+    private String assNum;
 
     @ApiModelProperty(value = "辅助单位")
     private String auxiliaryUnit;
@@ -75,6 +75,7 @@ public class ProductionShipmentNotification  extends Base {
 
     @ApiModelProperty(value = "产品类型")
     private String productType;
+    private String productNum;
 
     @ApiModelProperty(value = "扣分合计")
     private Integer totalDeduction;

+ 1 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/base/domain/param/ProductionRegularPlanRequest.java

@@ -38,6 +38,7 @@ public class ProductionRegularPlanRequest extends  PageRequest{
     private  String   startWhiteStripNum;
     private  String   endWhiteStripNum;
     private  String   qualityInspectionResult;
+    private  String   productTypes;
 
 
 

+ 6 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/sales/domain/SalesOrderGoods.java

@@ -59,6 +59,12 @@ public class SalesOrderGoods extends Base {
     @Excel(name = "换算值")
     private String conversionValue;
 
+//    @ApiModelProperty(value = "客户")
+//    private String customerName;
+//    private String customerNum;
+//    @ApiModelProperty(value = "金额")
+//    private String totalAmount;
+
     @ApiModelProperty(value = "小计")
     @Excel(name = "小计")
     @TableField(value = "sub_total", insertStrategy = FieldStrategy.NOT_NULL, updateStrategy = FieldStrategy.NOT_NULL)

+ 1 - 1
ruoyi-admin/src/main/resources/mapper/ProductionShipmentNotificationMapper.xml

@@ -35,7 +35,7 @@
     <select id="listTree" resultType="com.ruoyi.web.base.domain.param.ProductionRegularPlanParam">
 
 
-        SELECT a.customer custtomer , a.customer_number    customerNum,
+        SELECT a.customer customer , a.customer_number    customerNum,
          c.market_name  marketName , b.market_num marketNum ,b.line_num  lineNum ,
          d.line_name   lineName FROM  `production_shipment_notification`  a
         LEFT JOIN   `rel_customer_market` b ON  a.customer_number = b.customer_num