瀏覽代碼

Merge remote-tracking branch 'origin/master'

hmc 1 年之前
父節點
當前提交
ca0f18f853
共有 29 個文件被更改,包括 1062 次插入147 次删除
  1. 1 1
      zkqy-custom-business/src/main/java/com/zkqy/business/controller/ProductCodeListController.java
  2. 6 1
      zkqy-custom-business/src/main/java/com/zkqy/business/controller/ProductInvoiceController.java
  3. 19 8
      zkqy-custom-business/src/main/java/com/zkqy/business/controller/ProductionController.java
  4. 10 1
      zkqy-custom-business/src/main/java/com/zkqy/business/controller/SaleOrderController.java
  5. 11 0
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductCodeList.java
  6. 12 1
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/Production.java
  7. 11 0
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/SaleOrderVO.java
  8. 5 0
      zkqy-custom-business/src/main/java/com/zkqy/business/mapper/ProductCodeListMapper.java
  9. 1 1
      zkqy-custom-business/src/main/java/com/zkqy/business/mapper/ProductInvoiceMapper.java
  10. 15 0
      zkqy-custom-business/src/main/java/com/zkqy/business/mapper/ProductionMapper.java
  11. 5 0
      zkqy-custom-business/src/main/java/com/zkqy/business/service/IProductCodeListService.java
  12. 1 1
      zkqy-custom-business/src/main/java/com/zkqy/business/service/IProductInvoiceService.java
  13. 13 0
      zkqy-custom-business/src/main/java/com/zkqy/business/service/IProductionService.java
  14. 5 0
      zkqy-custom-business/src/main/java/com/zkqy/business/service/ISaleOrderService.java
  15. 5 0
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductCodeListServiceImpl.java
  16. 3 1
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductInventoryServiceImpl.java
  17. 2 1
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductInvoiceServiceImpl.java
  18. 11 0
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductionServiceImpl.java
  19. 20 0
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/SaleOrderServiceImpl.java
  20. 18 0
      zkqy-custom-business/src/main/resources/mapper/business/ProductCodeListMapper.xml
  21. 1 0
      zkqy-custom-business/src/main/resources/mapper/business/ProductInventoryMapper.xml
  22. 8 7
      zkqy-custom-business/src/main/resources/mapper/business/ProductInvoiceMapper.xml
  23. 37 0
      zkqy-custom-business/src/main/resources/mapper/business/ProductionMapper.xml
  24. 6 5
      zkqy-ui/src/views/orderMange/codeListManage/printIndex.vue
  25. 40 35
      zkqy-ui/src/views/orderMange/components/dialogForm/OutStock.vue
  26. 733 44
      zkqy-ui/src/views/orderMange/financialReconciliation/index.vue
  27. 12 8
      zkqy-ui/src/views/orderMange/index.vue
  28. 4 1
      zkqy-ui/src/views/orderMange/outStock/index.vue
  29. 47 31
      zkqy-ui/src/views/orderMange/retailMange/index.vue

+ 1 - 1
zkqy-custom-business/src/main/java/com/zkqy/business/controller/ProductCodeListController.java

@@ -91,7 +91,7 @@ public class ProductCodeListController extends BaseController {
      */
     @GetMapping("/queryCodeListByQrCode/{qrCode}")
     public AjaxResult queryCodeListByQrCode(@PathVariable("qrCode") String qrCode) {
-        return success(productCodeListService.selectProductCodeListByQrCode(qrCode));
+        return success(productCodeListService.selectProductCodeInfoByQrCode(qrCode));
     }
 
 

+ 6 - 1
zkqy-custom-business/src/main/java/com/zkqy/business/controller/ProductInvoiceController.java

@@ -9,7 +9,11 @@ import javax.servlet.http.HttpServletResponse;
 import com.zkqy.business.domain.vo.ProductInvoiceFinancialExportVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.core.userdetails.User;
 import org.springframework.web.bind.annotation.*;
 import com.zkqy.common.annotation.Log;
 import com.zkqy.common.core.controller.BaseController;
@@ -97,7 +101,8 @@ public class ProductInvoiceController extends BaseController {
     @Log(title = "产品发货单", businessType = BusinessType.DELETE)
     @DeleteMapping("/{ids}")
     @ApiOperation(value = "删除产品发货单")
-    public AjaxResult remove(@PathVariable Long[] ids) {
+    public AjaxResult remove(@PathVariable List<Long> ids)
+    {
         return toAjax(productInvoiceService.deleteProductInvoiceByIds(ids));
     }
 

+ 19 - 8
zkqy-custom-business/src/main/java/com/zkqy/business/controller/ProductionController.java

@@ -6,14 +6,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import com.zkqy.common.annotation.Log;
 import com.zkqy.common.core.controller.BaseController;
 import com.zkqy.common.core.domain.AjaxResult;
@@ -119,4 +112,22 @@ public class ProductionController extends BaseController
     {
         return success(productionService.selectSaleOrderProductionList(new Production()));
     }
+
+    /**
+     * 销售单产品列表(根据品名去重排序)
+     */
+    @GetMapping("/getSaleOrderProductionListDistinct")
+    public AjaxResult getSaleOrderProductionListDistinct()
+    {
+        return success(productionService.getSaleOrderProductionListDistinct(new Production()));
+    }
+
+    /**
+     * 根据品名获取对应规格信息和是否有默认规格信息
+     */
+    @GetMapping("/getProductSpecificationsByProductName")
+    public AjaxResult getProductSpecificationsByProductName(@RequestParam("productName") String productName){
+        return success(productionService.getProductSpecificationsByProductName(productName));
+    }
+
 }

+ 10 - 1
zkqy-custom-business/src/main/java/com/zkqy/business/controller/SaleOrderController.java

@@ -148,7 +148,7 @@ public class SaleOrderController extends BaseController {
     @PreAuthorize("@ss.hasPermi('system:RetailOrder:insert')")
     @PostMapping("/addRetailOrder")
     public AjaxResult addRetailOrder(@RequestBody SaleOrderVO vo) {
-        return success(saleOrderService.addRetailOrder(vo));
+        return toAjax(saleOrderService.addRetailOrder(vo));
     }
 
 
@@ -201,5 +201,14 @@ public class SaleOrderController extends BaseController {
     }
 
 
+    /**
+     * 修改订单
+     */
+    @PutMapping("/updateOrder")
+    public AjaxResult updateOrder(@RequestBody SaleOrder saleOrder)
+    {
+        return toAjax(saleOrderService.updateOrder(saleOrder));
+    }
+
 
 }

+ 11 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductCodeList.java

@@ -115,6 +115,17 @@ public class ProductCodeList extends BaseEntity
     /** 合计毛重 */
     private Double totalGrossWeight;
 
+    //码单uuid
+    private String qrCodeId;
+
+    public String getQrCodeId() {
+        return qrCodeId;
+    }
+
+    public void setQrCodeId(String qrCodeId) {
+        this.qrCodeId = qrCodeId;
+    }
+
     public Long getId() {
         return id;
     }

+ 12 - 1
zkqy-custom-business/src/main/java/com/zkqy/business/domain/Production.java

@@ -65,7 +65,18 @@ public class Production extends BaseEntity
     /** 任务节点编码 */
     private String taskNodeKey;
 
-    public void setId(Long id) 
+    //是否默认规格
+    private String isDefaultSpecifications;
+
+    public String getIsDefaultSpecifications() {
+        return isDefaultSpecifications;
+    }
+
+    public void setIsDefaultSpecifications(String isDefaultSpecifications) {
+        this.isDefaultSpecifications = isDefaultSpecifications;
+    }
+
+    public void setId(Long id)
     {
         this.id = id;
     }

+ 11 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/SaleOrderVO.java

@@ -102,6 +102,17 @@ public class SaleOrderVO {
     /** 备注 */
     private String remark;
 
+    //货车登记
+    private String truckRegistration;
+
+    public String getTruckRegistration() {
+        return truckRegistration;
+    }
+
+    public void setTruckRegistration(String truckRegistration) {
+        this.truckRegistration = truckRegistration;
+    }
+
     public Long getId() {
         return id;
     }

+ 5 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/mapper/ProductCodeListMapper.java

@@ -75,6 +75,11 @@ public interface ProductCodeListMapper
      */
     List<ProductCodeList> selectProductCodeListByQrCode(String qrCode);
 
+    /**
+     * 根据码单号查询码单信息和码单唯一标识
+     */
+    List<ProductCodeList> selectProductCodeInfoByQrCode(String qrCode);
+
     /**
      * 获取当前吗码单完整信息
      */

+ 1 - 1
zkqy-custom-business/src/main/java/com/zkqy/business/mapper/ProductInvoiceMapper.java

@@ -59,7 +59,7 @@ public interface ProductInvoiceMapper {
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
-    public int deleteProductInvoiceByIds(Long[] ids);
+    public int deleteProductInvoiceByIds(List<Long> ids);
 
     /**
      * 查询产品发货单

+ 15 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/mapper/ProductionMapper.java

@@ -68,6 +68,21 @@ public interface ProductionMapper
      */
     List<Production> selectSaleOrderProductionList(Production production);
 
+    /**
+     * 销售单查询产品列表(根据品名排序)
+     *
+     * @param production 产品
+     * @return 产品集合
+     */
+    List<Production> getSaleOrderProductionListDistinct(Production production);
+
+    /**
+     * 根据品名获取对应规格信息和是否有默认规格信息
+     */
+    List<Production> selectProductSpecificationsByProductName(String productName);
+
+
 
+    //导入库存数据
 //    Long aaaa(String productName);
 }

+ 5 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/IProductCodeListService.java

@@ -89,4 +89,9 @@ public interface IProductCodeListService
      */
     public AjaxResult deleteProductCodeListInfoByInfo(ProductCodeListVO productCodeListVO);
 
+    /**
+     * 根据码单号查询码单信息和唯一标识uuid
+     */
+    List<ProductCodeList> selectProductCodeInfoByQrCode(String qrCode);
+
 }

+ 1 - 1
zkqy-custom-business/src/main/java/com/zkqy/business/service/IProductInvoiceService.java

@@ -53,7 +53,7 @@ public interface IProductInvoiceService {
      * @param ids 需要删除的产品发货单主键集合
      * @return 结果
      */
-    public int deleteProductInvoiceByIds(Long[] ids);
+    public int deleteProductInvoiceByIds(List<Long> ids);
 
     /**
      * 删除产品发货单信息

+ 13 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/IProductionService.java

@@ -67,4 +67,17 @@ public interface IProductionService
      */
     List<Production> selectSaleOrderProductionList(Production production);
 
+    /**
+     * 销售单查询产品列表(根据品名去重排序)
+     *
+     * @param production 产品
+     * @return 产品集合
+     */
+    List<Production> getSaleOrderProductionListDistinct(Production production);
+
+    /**
+     * 根据品名获取对应规格信息和是否有默认规格信息
+     */
+    List<Production> getProductSpecificationsByProductName(String productName);
+
 }

+ 5 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/ISaleOrderService.java

@@ -119,4 +119,9 @@ public interface ISaleOrderService {
      */
     int cancelRetailOrder(ProductInvoice productInvoice);
 
+    /**
+     * 修改订单
+     */
+    int updateOrder(SaleOrder saleOrder);
+
 }

+ 5 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductCodeListServiceImpl.java

@@ -258,4 +258,9 @@ public class ProductCodeListServiceImpl implements IProductCodeListService {
         return iProductInventoryService.deleteInventorByProductCodeListVO(productCodeListVO);
     }
 
+    @Override
+    public List<ProductCodeList> selectProductCodeInfoByQrCode(String qrCode) {
+        return productCodeListMapper.selectProductCodeInfoByQrCode(qrCode);
+    }
+
 }

+ 3 - 1
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductInventoryServiceImpl.java

@@ -309,7 +309,9 @@ public class ProductInventoryServiceImpl implements IProductInventoryService {
         if (saleOrder1.getSaleOrderTechnologyNo().equals("retailOrder")) {
             SaleOrder saleOrder = new SaleOrder();
             saleOrder.setSaleNo(productInvoice2.getSaleOrderNo());
-            saleOrder.setStatus("6");
+
+            //已出库状态
+            saleOrder.setStatus("9");
             saleOrderMapper.updateSaleOrderBySaleNo(saleOrder);
         }
         return AjaxResult.success();

+ 2 - 1
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductInvoiceServiceImpl.java

@@ -101,7 +101,8 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService {
      * @return 结果
      */
     @Override
-    public int deleteProductInvoiceByIds(Long[] ids) {
+    public int deleteProductInvoiceByIds(List<Long> ids)
+    {
         return productInvoiceMapper.deleteProductInvoiceByIds(ids);
     }
 

+ 11 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductionServiceImpl.java

@@ -98,4 +98,15 @@ public class ProductionServiceImpl implements IProductionService
     public List<Production> selectSaleOrderProductionList(Production production) {
         return productionMapper.selectSaleOrderProductionList(production);
     }
+
+    @Override
+    public List<Production> getSaleOrderProductionListDistinct(Production production) {
+        return productionMapper.getSaleOrderProductionListDistinct(production);
+    }
+
+    @Override
+    public List<Production> getProductSpecificationsByProductName(String productName) {
+        return productionMapper.selectProductSpecificationsByProductName(productName);
+    }
+
 }

+ 20 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/SaleOrderServiceImpl.java

@@ -122,6 +122,9 @@ public class SaleOrderServiceImpl implements ISaleOrderService
             if(saleProductsIds.size() > 0){
                 saleProductsMapper.deleteSaleProductsByIds(saleProductsIds);
             }
+            //根据合同号删除通知单
+            productInvoiceMapper.deleteProductInvoiceBySaleOrderNo(saleOrder.getSaleNo());
+
         });
         //删除销售工艺
         if(saleOrderNos.size() > 0){
@@ -224,12 +227,24 @@ public class SaleOrderServiceImpl implements ISaleOrderService
         saleProducts.setSaleOrderNo(saleOrder.getSaleNo());
         List<SaleProducts> saleProductsList = saleProductsMapper.selectSaleProductsList(saleProducts);
         saleOrderVO.setSaleProductsList(saleProductsList);
+
+        // 获取通知单详情
+        ProductInvoice productInvoice = productInvoiceMapper.selectProductInvoiceBySaleOrderNo(saleOrder.getSaleNo());
+        saleOrderVO.setTruckRegistration(productInvoice.getTruckRegistration());
         return saleOrderVO;
     }
 
     @Override
     @Transactional
     public int editRetailOrder(SaleOrderVO vo) {
+        //修改通知单
+        ProductInvoice productInvoice = productInvoiceMapper.selectProductInvoiceBySaleOrderNo(vo.getSaleNo());
+        productInvoice.setTruckRegistration(vo.getTruckRegistration());
+        productInvoice.setCreateById(SecurityUtils.getUserId());
+        productInvoice.setUpdateTime(DateUtils.getNowDate());
+        productInvoice.setUpdateBy(SecurityUtils.getUsername());
+        productInvoiceMapper.updateProductInvoice(productInvoice);
+
         //修改零售单
         SaleOrder saleOrder = new SaleOrder();
         BeanUtils.copyBeanProp(saleOrder,vo);
@@ -304,4 +319,9 @@ public class SaleOrderServiceImpl implements ISaleOrderService
         return saleOrderMapper.updateSaleOrderBySaleNo(saleOrder);
     }
 
+    @Override
+    public int updateOrder(SaleOrder saleOrder) {
+        return saleOrderMapper.updateSaleOrder(saleOrder);
+    }
+
 }

+ 18 - 0
zkqy-custom-business/src/main/resources/mapper/business/ProductCodeListMapper.xml

@@ -40,6 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="totalBoxNum" column="total_box_num"/>
         <result property="totalSuttle" column="total_suttle"/>
         <result property="totalGrossWeight" column="total_gross_weight"/>
+        <result property="qrCodeId" column="qr_code_id"/>
     </resultMap>
 
     <resultMap type="com.zkqy.business.domain.vo.ProductCodeListVO" id="ProductCodeListResultVO">
@@ -276,6 +277,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where qr_code = #{qrCode} and del_flag = '0'
     </select>
 
+    <select id="selectProductCodeInfoByQrCode" parameterType="string" resultMap="ProductCodeListResult">
+        SELECT
+            pcl.*,
+            pwr.qr_code_id
+        FROM
+            {DBNAME}.product_code_list pcl
+                LEFT JOIN {DBNAME}.product_warehousing_record pwr ON pcl.qr_code = pwr.qr_code
+                AND pcl.lot_num = pwr.lot_num
+                AND pcl.product_id = pwr.product_id
+                AND pcl.product_colour = pwr.product_colour
+                AND pcl.levels = pwr.levels
+                and pcl.box_num = pwr.box_num
+                and pwr.del_flag = '0'
+        where pcl.del_flag = '0' and pcl.qr_code = #{qrCode}
+    </select>
+
+
     <select id="getProductCodeListById" resultMap="ProductCodeListResultVO">
         SELECT
             *

+ 1 - 0
zkqy-custom-business/src/main/resources/mapper/business/ProductInventoryMapper.xml

@@ -215,6 +215,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where del_flag = '0'
         <if test="lotNum != null and lotNum != '' ">and lot_num = #{lotNum}</if>
         <if test="productId != null">and product_id = #{productId}</if>
+        <if test="productColour != null and productColour != ''"> and product_colour = #{productColour}</if>
     </select>
 
     <select id="selectComprehensiveInventoryList" resultType="com.zkqy.business.domain.vo.ProductCodeListVO">

+ 8 - 7
zkqy-custom-business/src/main/resources/mapper/business/ProductInvoiceMapper.xml

@@ -167,8 +167,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         delete from product_invoice where id = #{id}
     </delete>
 
-    <delete id="deleteProductInvoiceByIds" parameterType="String">
-        delete from product_invoice where id in 
+    <delete id="deleteProductInvoiceByIds" >
+        update {DBNAME}.product_invoice set del_flag = '0' where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>
@@ -200,12 +200,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         so.status,
         so.order_type,
         so.delivery_date,
-        so.remark
-        from `huaxian`.sale_order so
-        left join `huaxian`.customer c on
-        so.sale_custom_no = c.custom_no
+        so.remark,
+        pi.id as product_invoice_id
+        from {DBNAME}.sale_order so
+        left join {DBNAME}.customer c on
+        so.sale_custom_no = c.custom_no and c.del_flag = '0'
+        left join {DBNAME}.product_invoice pi on pi.sale_order_no = so.sale_no and pi.del_flag = '0'
         where so.del_flag = '0'
-        and c.del_flag = '0'
         and so.status = 6
         <if test="noticeNumber != null  and noticeNumber != ''">and so.notice_number = #{noticeNumber}</if>
         <if test="customerId != null  and customerId != ''">and c.id = #{customerId}</if>

+ 37 - 0
zkqy-custom-business/src/main/resources/mapper/business/ProductionMapper.xml

@@ -24,6 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="delFlag"    column="del_flag"    />
         <result property="taskProcessKey"    column="task_process_key"    />
         <result property="taskNodeKey"    column="task_node_key"    />
+        <result property="isDefaultSpecifications" column="is_default_specifications"/>
     </resultMap>
 
     <sql id="selectProductionVo">
@@ -140,9 +141,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="productDescribe != null  and productDescribe != ''"> and product_describe = #{productDescribe}</if>
             <if test="productUnit != null  and productUnit != ''"> and product_unit = #{productUnit}</if>
             <if test="productTypeNo != null "> and product_type_no = #{productTypeNo}</if>
+--              group by product_name
              order by product_name asc
     </select>
 
+    <select id="getSaleOrderProductionListDistinct" parameterType="com.zkqy.business.domain.Production" resultMap="ProductionResult">
+        <include refid="selectProductionVo"/>
+        where del_flag = '0'
+        <if test="productNo != null  and productNo != ''"> and product_no = #{productNo}</if>
+        <if test="productName != null  and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
+        <if test="productSpecifications != null  and productSpecifications != ''"> and product_specifications = #{productSpecifications}</if>
+        <if test="productColor != null  and productColor != ''"> and product_color = #{productColor}</if>
+        <if test="productType != null  and productType != ''"> and product_type = #{productType}</if>
+        <if test="productDescribe != null  and productDescribe != ''"> and product_describe = #{productDescribe}</if>
+        <if test="productUnit != null  and productUnit != ''"> and product_unit = #{productUnit}</if>
+        <if test="productTypeNo != null "> and product_type_no = #{productTypeNo}</if>
+        group by product_name
+        order by product_name asc
+    </select>
+
+    <select id="selectProductSpecificationsByProductName" parameterType="string" resultMap="ProductionResult">
+        SELECT
+            p.*,
+            CASE
+                WHEN pc.default_specifications = p.product_specifications THEN 1
+                ELSE null
+                END AS is_default_specifications
+        FROM
+            {DBNAME}.production p
+                LEFT JOIN
+            {DBNAME}.product_code pc
+            ON p.product_name = pc.code_name
+                AND pc.code_type = 'product_name'
+        WHERE
+            p.del_flag = '0'
+          AND pc.del_flag = '0'
+          AND p.product_name = #{productName}
+
+    </select>
+
 
 <!--    <select id="aaaa" resultType="long">-->
 <!--        select id from {DBNAME}.production where CONCAT(product_type,product_name,product_specifications) = #{productName}-->

+ 6 - 5
zkqy-ui/src/views/orderMange/codeListManage/printIndex.vue

@@ -1104,13 +1104,13 @@ export default {
       });
       this.changeGrossWeight(this.printTableData[0]);
       // 前端打印
-      codeListPrint(this.printTableData, "printDom");
+      // codeListPrint(this.printTableData, "printDom");
 
-      if (this.excuteType == 1) {
-        this.tableData.push(this.printTableData[0]);
-      }
+      // if (this.excuteType == 1) {
+      //   this.tableData.push(this.printTableData[0]);
+      // }
       // 后端打印
-      // this.newPrintHandler();
+      this.newPrintHandler();
     },
     // 获取机台选项数据
     async getLineOptionLsit() {
@@ -1131,6 +1131,7 @@ export default {
     },
     // 补码打印回调
     handleSuppleOne(row) {
+      console.log(row);
       this.printTableData = [row];
       this.printConfirmHandler(row.id);
     },

+ 40 - 35
zkqy-ui/src/views/orderMange/components/dialogForm/OutStock.vue

@@ -1,7 +1,9 @@
 <template>
   <div class="table-container">
-    <div style="float: right;margin: 0px;padding: 0px">
-      <el-button @click="exportOutInfo" type="success" icon="el-icon-download">导出明细</el-button>
+    <div style="float: right; margin: 0px; padding: 0px">
+      <el-button @click="exportOutInfo" type="success" icon="el-icon-download"
+        >导出明细</el-button
+      >
     </div>
     <div style="clear: both"></div>
     <el-row :gutter="20" class="mb10">
@@ -32,7 +34,7 @@
       :summary-method="getSummaries"
       show-summary
     >
-      <el-table-column type="index" width="50"/>
+      <el-table-column type="index" width="50" />
       <el-table-column prop="productName" label="品名"></el-table-column>
       <el-table-column prop="productSpecifications" label="规格">
       </el-table-column>
@@ -48,7 +50,9 @@
           <el-button
             size="mini"
             type="danger"
-            @click="handleDelete(scope.$index, scope.row)">删除</el-button>
+            @click="handleDelete(scope.$index, scope.row)"
+            >删除</el-button
+          >
         </template>
       </el-table-column>
     </el-table>
@@ -63,10 +67,9 @@
 </template>
 
 <script>
-import {outboundDetails} from "@/api/system/retailMange.js";
+import { outboundDetails } from "@/api/system/retailMange.js";
 import moment from "moment";
-import {removeErrorOutboundRecord} from "@/api/system/ProductWarehousingRecord";
-
+import { removeErrorOutboundRecord } from "@/api/system/ProductWarehousingRecord";
 
 export default {
   name: "OutStock",
@@ -76,7 +79,7 @@ export default {
     return {
       tableData: [],
       row: {},
-      orderRow:{},
+      orderRow: {},
       // 分页相关
       total: 0,
       queryParams: {
@@ -85,49 +88,50 @@ export default {
       },
     };
   },
-  computed: {
-
-  },
+  computed: {},
   created() {
-    this.orderRow={}
+    this.orderRow = {};
   },
   methods: {
     //删除回滚对应产品的库存
-    handleDelete(index,row){
-      this.$confirm("是否删除名称为 “"+row.productName+"” 出库明细数据", "提示", { type: "warning" }).then(
-        () => {
-          removeErrorOutboundRecord(row.id).then(res=>{
-            if (res.code == 200) {
-              this.$message.success("删除成功");
-              this.getOutStockDetail(this.orderRow);
-            } else {
-              this.$message.error("删除失败");
-              throw Error("删除失败");
-            }
-          })
-        }
-      );
+    handleDelete(index, row) {
+      this.$confirm(
+        "是否删除名称为 “" + row.productName + "” 出库明细数据",
+        "提示",
+        { type: "warning" }
+      ).then(() => {
+        removeErrorOutboundRecord(row.id).then((res) => {
+          if (res.code == 200) {
+            this.$message.success("删除成功");
+            this.getOutStockDetail(this.orderRow);
+          } else {
+            this.$message.error("删除失败");
+            throw Error("删除失败");
+          }
+        });
+      });
       //出库
-      console.log("删除出库产品、回滚库存",row)
+      console.log("删除出库产品、回滚库存", row);
     },
     exportOutInfo() {
       if (this.tableData.length == 0) {
-        this.$message.warning("没有出库数据!")
+        this.$message.warning("没有出库数据!");
         return;
       }
-      let {saleNo} = this.row;
+      let { saleNo } = this.row;
       // 出库明细导出
-      this.download("system/ProductOutboundRecord/importDataOutboundDetails",
+      this.download(
+        "system/ProductOutboundRecord/importDataOutboundDetails",
         {
           saleOrderNo: saleNo,
-          isEnablePaging: false
+          isEnablePaging: false,
         },
         `${saleNo}_出库明细_${new Date().getTime()}.xlsx`
       );
     },
     // 自定义的小计计算方法
     getSummaries(param) {
-      const {columns, data} = param;
+      const { columns, data } = param;
       const sums = [];
       columns.forEach((column, index) => {
         if (index === 5) {
@@ -142,7 +146,8 @@ export default {
           index === 3 ||
           index === 4 ||
           index === 8 ||
-          index === 9
+          index === 9 ||
+          index === 10
         ) {
           sums[index] = "";
         } else if (!values.every((value) => isNaN(value))) {
@@ -171,8 +176,8 @@ export default {
     },
     // 获取出库详情
     async getOutStockDetail(row) {
-      this.orderRow =row;
-      let {saleNo} = row;
+      this.orderRow = row;
+      let { saleNo } = row;
       this.row = row;
       console.log(this.row.status,"ddddd")
       try {

+ 733 - 44
zkqy-ui/src/views/orderMange/financialReconciliation/index.vue

@@ -13,31 +13,26 @@
           v-model="queryParams.orderType"
           placeholder="订单类型"
           @keyup.enter.native.prevent
-          @change="handleQuery">
-          <el-option
-            key="contractOrder"
-            label="合同单"
-            value="false">
+          @change="handleQuery"
+        >
+          <el-option key="contractOrder" label="合同单" value="contractOrder">
           </el-option>
-          <el-option
-            key="retailOrder"
-            label="零售单"
-            value="true">
+          <el-option key="retailOrder" label="零售单" value="retailOrder">
           </el-option>
         </el-select>
       </el-form-item>
-      <el-form-item label="通知单号" prop="noticeNumber">
+      <el-form-item label="合同号" prop="saleNo">
         <el-input
-          v-model="queryParams.noticeNumber"
+          v-model="queryParams.saleNo"
           placeholder="请输入通知单号"
           clearable
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item label="日期" prop="noticeDate">
+      <el-form-item label="日期" prop="saleDate">
         <el-date-picker
           clearable
-          v-model="queryParams.noticeDate"
+          v-model="queryParams.saleDate"
           type="date"
           value-format="yyyy-MM-dd"
           placeholder="请选择通知日期"
@@ -87,13 +82,11 @@
           icon="el-icon-search"
           size="mini"
           @click="handleQuery"
-        >搜索
-        </el-button
-        >
+          >搜索
+        </el-button>
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
-        >重置
-        </el-button
-        >
+          >重置
+        </el-button>
       </el-form-item>
     </el-form>
 
@@ -142,9 +135,8 @@
           size="mini"
           @click="handleExport"
           v-hasPermi="['system:ProductInvoice:export']"
-        >导出
-        </el-button
-        >
+          >导出
+        </el-button>
       </el-col>
       <right-toolbar
         :showSearch.sync="showSearch"
@@ -159,17 +151,13 @@
     >
       <!-- <el-table-column label="编号" align="center" prop="id" />
        -->
-      <el-table-column
-        label="日期"
-        align="center"
-        prop="noticeDate"
-        width="180"
-      >
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="日期" align="center" prop="saleDate" width="180">
         <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.noticeDate, "{y}-{m}-{d}") }}</span>
+          <span>{{ parseTime(scope.row.saleDate, "{y}-{m}-{d}") }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="通知单号" align="center" prop="noticeNumber"/>
+      <el-table-column label="合同号" align="center" prop="saleNo" />
 
       <!-- <el-table-column label="销售员" align="center" prop="salesman" />
       <el-table-column label="客户编号" align="center" prop="customerId" />
@@ -189,7 +177,13 @@
       <el-table-column label="售货单位" align="center" prop="sellingUnit" />
       <el-table-column label="计算类型" align="center" prop="calculationType" />
       <el-table-column label="审核意见" align="center" prop="auditOpinion" /> -->
-      <el-table-column label="客户名称" align="center" prop="customerName"/>
+      <el-table-column label="客户名称" align="center" prop="customName" />
+      <el-table-column
+        label="金额(大写)"
+        align="center"
+        prop="saleAmountInWords"
+      />
+      <el-table-column label="销售" align="center" prop="salesman" />
       <!-- <el-table-column label="状态" align="center" prop="status">
         <template slot-scope="scope">{{ scope.row.status }}</template>
       </el-table-column> -->
@@ -216,10 +210,23 @@
                 >
               </el-dropdown-item> -->
               <el-dropdown-item>
-                <el-button type="text" size="mini" @click="handleSendOrder(scope.$index, scope.row)">
+                <el-button
+                  type="text"
+                  size="mini"
+                  @click="handleSendOrder(scope.$index, scope.row)"
+                >
                   打印对账单
                 </el-button>
               </el-dropdown-item>
+              <el-dropdown-item>
+                <el-button
+                  type="text"
+                  size="mini"
+                  @click="handleDetail(scope.$index, scope.row)"
+                >
+                  详情
+                </el-button>
+              </el-dropdown-item>
             </el-dropdown-menu>
           </el-dropdown>
         </template>
@@ -233,6 +240,16 @@
       :limit.sync="queryParams.pageSize"
       @pagination="getList"
     />
+    <!-- 详情弹窗 -->
+    <el-dialog title="详情" :visible.sync="detailShow" width="1250px">
+      <div ref="detailTable" id="detail"></div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="detailShow = false">关 闭</el-button>
+        <!-- <el-button type="primary" @click="detailPrintHandler"
+            >打 印</el-button
+          > -->
+      </span>
+    </el-dialog>
     <div id="printDom"></div>
   </div>
 </template>
@@ -251,13 +268,36 @@ import {
   productInvoiceInfo,
   queryDropDownBoxData,
   printDocuments,
+  getProductSpecificationsByProductName,
 } from "@/api/tablelist/commonTable";
-import {mapState} from "vuex";
+import { getSaleOrderProductionList } from "@/api/dragform/form";
+import { mapState } from "vuex";
+import {
+  saleOrderList,
+  getRoleUser,
+  addRetailOrder,
+  getRetailOrderInfo,
+  editRetailOrder,
+  retailProductInvoiceInfo,
+  submitRetailOrder,
+  cancelRetailOrder,
+  deleRetailOrder,
+  submitProductInvoice,
+  getProductInventory,
+  updateOrder,
+} from "@/api/system/retailMange.js";
 
 export default {
   name: "ProductInvoice",
+  dicts: ["sales_order_type", "payment_method", "direction_of_twist"],
   data() {
     return {
+      formData: {},
+      salesmanList: [],
+      colourNumberOptions: [],
+      sliceTypeOptions: [],
+      allProductionOptions: [],
+      detailShow: false,
       customerOptions: [],
       // 遮罩层
       loading: true,
@@ -279,6 +319,8 @@ export default {
       open: false,
       // 查询参数
       queryParams: {
+        saleDate: "",
+        saleNo: "",
         pageNum: 1,
         pageSize: 10,
         noticeNumber: null,
@@ -294,7 +336,7 @@ export default {
         calculationType: null,
         auditOpinion: null,
         status: 2,
-        orderType: "contractOrder"  // 零售单/合同单
+        orderType: "contractOrder", // 零售单/合同单
       },
       // 表单参数
       form: {},
@@ -307,13 +349,612 @@ export default {
   },
   computed: {
     ...mapState({
+      nickName: (state) => state.user.nickName,
+      userInfo: (state) => state.user,
       username: (state) => state.user.name,
     }),
   },
   methods: {
+    // 客户名称改变回调
+    customChangeHandler(val) {
+      // if (!val) return;
+      let customData = this.customerOptions.find(
+        (item) => item.customNo == val
+      );
+      this.formData.customAddress = customData?.customAddress || "无";
+      this.formData.customCountryType = customData?.customCountryType || "无";
+      this.formData.contactPerson = customData?.contactPerson || "无";
+    },
+    // 根据字典value获取字典label
+    getDictLabel(value, dict) {
+      return (
+        this.dict.type[dict].find((item) => {
+          return item.value === value;
+        })?.label || ""
+      );
+    },
+    // 获取详情数据
+    async handleDetail(index, row) {
+      if (this.queryParams.orderType == "contractOrder") {
+        //销售订单
+        this.printDomData = await this.getDetailTableString(row);
+        this.detailShow = true;
+        this.$nextTick(() => {
+          this.$refs.detailTable.innerHTML = this.printDomData;
+        });
+      } else {
+        // 零售订单
+        this.handlePrint(row);
+      }
+    },
+    // 获取销售员角色列表
+    async getRoleUser() {
+      try {
+        let res = await getRoleUser("salesman");
+        if (res.code == 200) {
+          this.salesmanList = res.data.map((item) => {
+            return {
+              label: item.nickName,
+              value: item.nickName,
+              id: item.userId,
+            };
+          });
+        } else {
+          this.$message.error("获取销售员角色列表失败");
+        }
+      } catch (error) {
+        console.log(error);
+      }
+    },
+    // 零售订单详情
+    async handlePrint(row) {
+      // await this.getDropDownData();
+      this.isLeader = !this.userInfo.roles.includes("salesman");
+      if (!this.isLeader) {
+        this.createById = this.userInfo.userId;
+      }
+      await this.getRoleUser();
+      try {
+        let res = await getRetailOrderInfo(row.id);
+        console.log(res);
+        if (res.code == 200) {
+          await this.initData(res.data);
+          this.printDomData = this.getPrintDom(res.data);
+          this.detailShow = true;
+          this.$nextTick(() => {
+            this.$refs.detailTable.innerHTML = this.printDomData;
+          });
+        } else {
+          this.$message.error(res.msg);
+        }
+      } catch (error) {
+        console.log(error);
+      }
+    },
+    async initData(data) {
+      let {
+        id,
+        //订单表数据
+        saleNo,
+        saleCustomNo,
+        saleDate,
+        saleOrderEstimatedTime,
+        saleLeadTime,
+        deliveryDate,
+        saleAmounts,
+        saleAmountInWords,
+        salePayType,
+        salesman,
+        customAddress,
+        customCountryType, //国家类型
+        contactPerson, //联系人
+        truckRegistration, //货车登记
+
+        // 工艺表数据
+        remark,
+
+        // 产品列表
+        saleProductsList,
+      } = data;
+      this.form.truckRegistration = truckRegistration;
+      Object.assign(this.formData, {
+        id,
+        //订单表数据
+        saleNo,
+        saleCustomNo,
+        saleDate,
+        saleOrderEstimatedTime,
+        saleLeadTime,
+        deliveryDate,
+        saleAmounts,
+        saleAmountInWords,
+        salePayType,
+        salesman,
+        customAddress,
+        customCountryType, //国家类型
+        contactPerson, //联系人
+
+        // 工艺表数据
+        orderRemark: remark,
+      });
+      this.customChangeHandler(saleCustomNo);
+      let promiseArr = [],
+        promiseArr2 = [];
+      this.productionTableData = saleProductsList.map((item, index) => {
+        let {
+          id,
+          saleProductNo,
+          productNo, //货品编号
+          productName, //货品名称
+          productNumber, //销售数量
+          productWeight, //销售重量kg
+          productUnitPrice, //单价
+          productAmounts, //金额
+          sliceType, //切片类型  初始为  切片
+          sliceTypeLabel,
+          colourNumberLabel,
+          colourNumber, //色号
+          remark, //备注
+          lotNumber, //批号
+        } = item;
+        let targetItem = this.allProductionOptions.find(
+          (i) => item.productNo == i.productNo
+        );
+        // item.productType = targetItem?.productType;
+        let productType = targetItem?.productType;
+        let productSpecifications = targetItem?.productSpecifications;
+        promiseArr[index] = getProductSpecificationsByProductName({
+          productName: item.productName,
+        });
+        promiseArr2[index] = getProductInventory({
+          productNo,
+          productType,
+          lotNumber,
+          productName,
+          productSpecifications,
+        });
+        return {
+          id,
+          saleProductNo,
+          productSpecifications, //规格
+          productNo, //货品编号
+          productType, //类型
+          productName, //货品名称
+          productNumber, //销售数量
+          productWeight, //销售重量kg
+          productUnitPrice, //单价
+          productAmounts, //金额
+          sliceType, //切片类型  初始为  切片
+          sliceTypeLabel,
+          colourNumberLabel,
+          colourNumber, //色号
+          remark,
+          lotNumber,
+          inventoryBoxNum: 0,
+          inventoryWeight: 0,
+          specificationsList: [],
+        };
+      });
+      let promiseRes = await Promise.all(promiseArr);
+      promiseRes.forEach((item, index) => {
+        this.productionTableData[index].specificationsList = item.data;
+      });
+      let promiseRes2 = await Promise.all(promiseArr2);
+      promiseRes2.forEach((item, index) => {
+        this.productionTableData[index].inventoryWeight =
+          item.data.inventoryWeight || 0;
+        this.productionTableData[index].inventoryBoxNum =
+          item.data.inventoryBoxNum || 0;
+      });
+    },
+    // 获取打印dom
+    getPrintDom(data) {
+      let {
+        id,
+        //订单表数据
+        saleNo,
+        saleCustomNo,
+        saleDate,
+        saleOrderEstimatedTime,
+        saleLeadTime,
+        deliveryDate,
+        saleAmounts,
+        saleAmountInWords,
+        salePayType,
+        salesman,
+        customAddress,
+        customCountryType, //国家类型
+        contactPerson, //联系人
+
+        // 工艺表数据
+        orderRemark,
+      } = this.formData;
+      console.log(this.form, this.productionTableData);
+      let { truckRegistration } = this.form;
+      let customData = this.customerOptions.find(
+        (item) => item.customNo == saleCustomNo
+      );
+      let customerName = customData ? customData.customName : "";
+      let printStr = `
+        <table style="width:1200px; border-collapse:collapse;" border="1" cellpadding="10" align="center">
+            <div style="text-align:center;font-size: 20px;">诸暨市新丝维纤维有限公司</div>
+            <div style="text-align:center;">销售合同审计单</div>
+            <tbody>
+                <tr>
+                    <td width="600px" colspan="4">合同号:${saleNo}</td>
+                    <td width="600px" colspan="5">日期:${saleDate.replace(
+                      "T",
+                      " "
+                    )}</td>
+                </tr>
+                <tr align="center">
+                    <td width="300px" colspan="2">客户名称:</td>
+                    <td width="300px" colspan="3">${customerName}</td>
+                    <td colspan="2">业务员:</td>
+                    <td colspan="2">${salesman}</td>
+
+                </tr>
+                <tr align="center">
+                    <td width="300px" colspan="2">客户地址:</td>
+                    <td width="300px" colspan="3">${customAddress}</td>
+                    <td width="300px" colspan="2">客户国别:</td>
+                    <td width="300px" colspan="2">${customCountryType}</td>
+                </tr>
+                <tr align="center">
+                    <td width="300px" colspan="2">联系人:</td>
+                    <td width="150px" colspan="2">${contactPerson}</td>
+                    <td  colspan="2">合计金额(大写):</td>
+                    <td colspan="3">${saleAmountInWords}</td>
+                </tr>
+                <tr align="center">
+                    <td colspan="9">货品明细</td>
+                </tr>
+                <tr align="center">
+                    <td width="150px">品名</td>
+                    <td width="100px">规格</td>
+                    <td width="100px">色号</td>
+                    <td width="100px">类型</td>
+                    <td width="100px">批号</td>
+                    <td width="100px">箱数</td>
+                    <td width="100px">单价</td>
+                    <td width="100px">金额</td>
+                    <td width="100px">备注</td>
+                </tr>`;
+      let amountTotal = 0,
+        singlTotal = 0,
+        moneyTotal = 0;
+      for (let i = 0; i < this.productionTableData.length; i++) {
+        let item = this.productionTableData[i];
+        amountTotal += Number(item.productNumber);
+        singlTotal += Number(item.productUnitPrice);
+        moneyTotal += Number(item.productAmounts);
+        let productData = this.allProductionOptions.find(
+          (pro) => pro.productNo == item.productNo
+        );
+        item.sliceTypeLabel =
+          this.sliceTypeOptions.find((k) => k.materielCode == item.sliceType)
+            ?.materielName || "";
+        item.colourNumberLabel = this.colourNumberOptions.find(
+          (k) => k.materielCode == item.colourNumber
+        )?.materieColorNumber;
+        let productName = productData ? productData.productName : "";
+        let productType = productData ? productData.productType : "";
+        printStr += `<tr align="center">
+                    <td>${item.productName}</td>
+                    <td>${item.productSpecifications}</td>
+                    <td>${item.colourNumberLabel}</td>
+                    <td>${item.productType}</td>
+                    <td>${item.lotNumber}</td>
+                    <td>${item.productNumber}</td>
+                    <td>${item.productUnitPrice}</td>
+                    <td>${item.productAmounts}</td>
+                    <td>${item.remark}</td>
+                </tr>`;
+      }
+      // 计算小计
+      amountTotal = amountTotal;
+      singlTotal = singlTotal.toFixed(2);
+      moneyTotal = moneyTotal.toFixed(2);
+      printStr += `
+        <tr align="center">
+          <td>小计:</td>
+           <td></td>
+           <td></td>
+          <td></td>
+          <td></td>
+          <td>${amountTotal}</td>
+          <td>${singlTotal}</td>
+          <td>${moneyTotal}</td>
+          <td></td>
+        </tr>`;
+      printStr += `<tr align="left">
+                    <td colspan="9">订单备注:${orderRemark}</td>
+                </tr>
+                </tbody>
+        </table>`;
+      return printStr;
+    },
+    // 获取详情html字符串
+    async getDetailTableString(row) {
+      let { saleNo } = row;
+      let payLoad = [
+        {
+          basicMap: {
+            tableName: "sale_order",
+          },
+          conditionMap: {
+            sale_no: [saleNo],
+          },
+        },
+        {
+          basicMap: {
+            tableName: "sale_products",
+          },
+          conditionMap: {
+            sale_order_no: [saleNo],
+          },
+        },
+        {
+          basicMap: {
+            tableName: "sale_craft",
+          },
+          conditionMap: {
+            sale_order_no: [saleNo],
+          },
+        },
+      ];
+      let res = await queryDropDownBoxData(payLoad);
+      if (res.code == 200) {
+        console.log(res);
+        let { sale_craft, sale_order, sale_products } = res.data.resultMap;
+        let {
+          //订单表数据
+          saleNo, //合同号
+          lotNumber, //批号
+          saleCustomNo, //客户编号
+          saleDate, //销售单日期
+          saleOrderEstimatedTime, //预计下单时间
+          saleLeadTime, //交货周期
+          deliveryDate,
+          saleAmounts, //合计金额 小写
+          saleAmountInWords, //合计金额 大写
+          salePayType, //支付方式
+          earnestMoney,
+          salesman, //业务员
+          saleLeader, //业务主管
+          finance, //财务部
+          production, //生产部
+          saleApprover, //批准人
+          // customAddress, //客户地址
+          // customCountryType, //国家类型
+          // contactPerson, //联系人
+          // 货品明细表数据
+          // productNo, //货品号
+          // productName, //货品名称
+          // productNumber: "", //销售数量
+          // productWeight: "", //销售重量kg
+          // productUnitPrice: "", //单价
+          // productAmounts: "", //金额
+          // remark: "", //备注
+          // 工艺表
+          craftGrid, //网络
+          craftOil, //油剂
+          craftPackage, //卷装
+          craftColorFastness, //色牢度
+          directionOfTwist,
+          craftOther, //其它工艺要求
+          craftMark, //包装/贴唛
+          shippingMethod, //运输方式
+        } = { ...sale_craft[0], ...sale_order[0] };
+        let customData = this.customerOptions.find(
+          (item) => item.customNo == saleCustomNo
+        );
+        let payType = this.getDictLabel(salePayType, "payment_method"); //付款方式
+        let customerName = customData ? customData.customName : "";
+        let customAddress = customData?.customAddress || "无";
+        let customCountryType = customData?.customCountryType || "";
+        let contactPerson = customData?.contactPerson || "无";
+        let directionOfTwistDescription = directionOfTwist
+          ? this.getDictLabel(directionOfTwist, "direction_of_twist")
+          : "";
+        let printStr = `
+        <table style="width:1200px; border-collapse:collapse;" border="1" cellpadding="10" align="center">
+            <div style="text-align:center;font-size: 20px;">诸暨市新丝维纤维有限公司</div>
+            <div style="text-align:center;">销售合同审计单</div>
+            <tbody>
+                <tr>
+                    <td width="600px" colspan="4">合同号:${saleNo}</td>
+                    <td width="600px" colspan="5">日期:${saleDate.replace(
+                      "T",
+                      " "
+                    )}</td>
+                </tr>
+                <tr align="center">
+                    <td width="300px" colspan="2">客户名称:</td>
+                    <td width="300px" colspan="2">${customerName}</td>
+                    <td width="300px" colspan="2">联系人:</td>
+                    <td width="150px" colspan="3">${contactPerson}</td>
+                </tr>
+                <tr align="center">
+                    <td width="300px" colspan="2">客户地址:</td>
+                    <td width="300px" colspan="3">${customAddress}</td>
+                    <td width="300px" colspan="2">客户国别:</td>
+                    <td width="300px" colspan="2">${customCountryType}</td>
+                </tr>
+                <tr align="center">
+                    <td width="300px" colspan="2">预计下单时间:</td>
+                    <td  colspan="1">${saleOrderEstimatedTime.replace(
+                      "T",
+                      " "
+                    )}</td>
+                    <td  colspan="2">交货周期:</td>
+                    <td >${saleLeadTime}</td>
+                    <td  colspan="2">交货日期:</td>
+                    <td >${deliveryDate.replace("T", " ")}</td>
+                </tr>
+                <tr align="center">
+                    <td colspan="9">货品明细</td>
+                </tr>
+                <tr align="center">
+                    <td width="150px">品名</td>
+                    <td width="100px">规格</td>
+                    <td width="100px">类型</td>
+                    <td width="100px">色号</td>
+                    <td width="150px">数量/kg</td>
+                    <td width="150px">单价</td>
+                    <td width="150px">金额</td>
+                    <td width="150px">切片型号</td>
+                    <td width="150px">备注</td>
+                </tr>`;
+        let amountTotal = 0,
+          singlTotal = 0,
+          moneyTotal = 0;
+        for (let i = 0; i < sale_products.length; i++) {
+          let item = sale_products[i];
+          amountTotal += Number(item.productNumber);
+          singlTotal += Number(item.productUnitPrice);
+          moneyTotal += Number(item.productAmounts);
+          let productData = this.allProductionOptions.find(
+            (pro) => pro.productNo == item.productNo
+          );
+          console.log(item.productNo, productData, this.allProductionOptions);
+          item.sliceTypeLabel =
+            this.sliceTypeOptions.find((k) => k.materielCode == item.sliceType)
+              ?.materielName || "";
+          item.colourNumberLabel = this.colourNumberOptions.find(
+            (k) => k.materielCode == item.colourNumber
+          )?.materieColorNumber;
+          // item.materieEncoding + item.materieColorNumber
+          let materieEncoding = this.colourNumberOptions.find(
+            (k) => k.materielCode == item.colourNumber
+          )?.materieEncoding;
+          let productName = productData ? productData.productName : "";
+          let productType = productData ? productData.productType : "";
+          let productSpecifications = productData
+            ? productData.productSpecifications
+            : ""; //规格
+          printStr += `<tr align="center">
+                    <td>${productName}</td>
+                    <td>${productSpecifications}</td>
+                    <td>${productType}</td>
+                    <td>${materieEncoding + item.colourNumberLabel}</td>
+                    <td>${item.productNumber}</td>
+                    <td>${item.productUnitPrice}</td>
+                    <td>${item.productAmounts}</td>
+                    <td>${item.sliceTypeLabel}</td>
+                    <td>${item.remark}</td>
+                </tr>`;
+        }
+        // 计算小计
+        printStr += `
+        <tr align="center">
+          <td>小计:</td>
+           <td></td>
+           <td></td>
+          <td></td>
+          <td>${amountTotal.toFixed(2)}</td>
+          <td>${singlTotal.toFixed(2)}</td>
+          <td>${moneyTotal.toFixed(2)}</td>
+          <td></td>
+          <td></td>
+        </tr>
+                <tr>
+                    <td colspan="9">合计金额(大写):${saleAmountInWords}</td>
+                </tr>
+                `;
+
+        if (salePayType == "1") {
+          //定金
+          printStr += `
+          <tr>
+            <td colspan="4">付款方式:${payType}</td>
+            <td colspan="5">定金:${earnestMoney}</td>
+          </tr>`;
+        } else {
+          printStr += `
+         <tr>
+              <td colspan="9">付款方式:${payType}</td>
+          </tr>`;
+        }
+        printStr += `<tr align="center">
+                    <td colspan="9">工艺要求</td>
+                </tr>
+                <tr align="center">
+                    <td width="150px">网络</td>
+                    <td width="150px">油剂</td>
+                    <td width="150px">卷装</td>
+                    <td width="150px">色牢度</td>
+                    <td width="150px">捻向</td>
+                    <td width="150px">其他</td>
+                    <td width="150px"></td>
+                    <td width="150px"></td>
+                    <td width="150px"></td>
+                </tr>
+                <tr align="center">
+                    <td >${craftGrid}</td>
+                    <td>${craftOil}</td>
+                    <td>${craftPackage}</td>
+                    <td>${craftColorFastness}</td>
+                    <td>${directionOfTwistDescription}</td>
+                    <td>${craftOther}</td>
+                    <td width="150px"></td>
+                    <td width="150px"></td>
+                    <td width="150px"></td>
+                </tr>
+                <tr>
+                    <td colspan="9">包装/贴唛:${craftMark}</td>
+                </tr>
+                <tr>
+                    <td colspan="9">装运方式:${shippingMethod}</td>
+                </tr>
+                <tr align="center">
+                    <td colspan="2">业务员:</td>
+                    <td colspan="2">${salesman}</td>
+                    <td colspan="2">财务部:</td>
+                    <td colspan="3">${finance}</td>
+
+                </tr>
+
+                <tr align="center">
+                    <td colspan="2">业务主管:</td>
+                    <td colspan="2">${saleApprover}</td>
+                    <td></td>
+                    <td></td>
+                    <td></td>
+                    <td></td>
+                    <td></td>
+                </tr>
+            </tbody>
+        </table>
+        `;
+        return printStr;
+        // <td colspan="2">业务主管:</td>
+        // <td colspan="2">${saleLeader}</td>
+        // <tr align="center">
+
+        //     // <td colspan="2">生产部:</td>
+        //     // <td colspan="2">${production}</td>
+        // </tr>
+        //         <tr align="center">
+        //             <td colspan="2"> 2</td>
+        //             <td> </td>
+        //             <td> </td>
+        //             <td> </td>
+        //             <td> </td>
+        //         </tr>
+        //         <tr>
+        //             <td colspan="2">小计:</td>
+        //             <td></td>
+        //             <td></td>
+        //             <td></td>
+        //             <td></td>
+        //         </tr>
+      }
+    },
     // 初始化下拉框数据
     async initDropDownBoxData() {
       try {
+        // 用户数据
         let res = await queryDropDownBoxData([
           {
             basicMap: {
@@ -327,13 +968,58 @@ export default {
         } else {
           throw new Error(res);
         }
+        // 产品数据
+        let proRes = await getSaleOrderProductionList();
+        if (proRes.code == 200) {
+          this.allProductionOptions = proRes.data || [];
+        } else {
+          throw Error("获取下拉框数据失败");
+        }
+        // 切片数据
+        let payLoad = [
+          {
+            basicMap: {
+              tableName: "materiel",
+            },
+            conditionMap: {
+              materiel_species: ["6"],
+            },
+          },
+        ];
+        let res2 = await queryDropDownBoxData(payLoad);
+        if (res2.code == 200) {
+          console.log(res2.data.resultMap);
+          let { materiel } = res2.data.resultMap;
+          this.sliceTypeOptions = materiel || [];
+        } else {
+          throw Error("获取下拉框数据失败");
+        }
+        // 颜色数据
+        let payLoad3 = [
+          {
+            basicMap: {
+              tableName: "materiel",
+            },
+            conditionMap: {
+              materiel_species: ["1"],
+            },
+          },
+        ];
+        let res3 = await queryDropDownBoxData(payLoad3);
+        if (res3.code == 200) {
+          console.log(res3.data.resultMap);
+          let { materiel } = res3.data.resultMap;
+          this.colourNumberOptions = materiel || [];
+        } else {
+          throw Error("获取下拉框数据失败");
+        }
       } catch (error) {
         console.log(error);
       }
     },
     // 打印发货单回调
     async handleDeliverOrder(index, row) {
-      let {saleOrderNo} = row;
+      let { saleOrderNo } = row;
       if (!saleOrderNo) {
         this.$message.error("数据异常,暂无saleOrderNo");
       }
@@ -350,7 +1036,7 @@ export default {
           printUser: this.username,
         });
         deliverOrderPrint(
-          {...row, ...printData, printUser: this.username},
+          { ...row, ...printData, printUser: this.username },
           "printDom"
         );
       } else {
@@ -361,15 +1047,18 @@ export default {
     },
     // 打印送货单回调
     async handleSendOrder(index, row) {
-      let {saleOrderNo} = row;
-      if (!saleOrderNo) {
-        this.$message.error("数据异常,暂无saleOrderNo");
+      let { saleNo } = row;
+      if (!saleNo) {
+        this.$message.error("数据异常,saleNo");
+        return;
       }
       let payload = {
-        saleOrderNo: saleOrderNo,
+        saleOrderNo: saleNo,
       };
       // let res = await productInvoiceInfo(payload);
-      let res = await printDocuments({id: row.id});
+      let res = await printDocuments({ id: row.id });
+      // console.log(res);
+      // return;
       if (res.code == 200) {
         let printData = res.data;
         console.log("printData", {
@@ -378,7 +1067,7 @@ export default {
           printUser: this.username,
         });
         sendOrderPrint(
-          {...row, ...printData, printUser: this.username},
+          { ...row, ...printData, printUser: this.username },
           "printDom"
         );
       } else {
@@ -497,8 +1186,7 @@ export default {
           this.getList();
           this.$modal.msgSuccess("删除成功");
         })
-        .catch(() => {
-        });
+        .catch(() => {});
     },
     /** 导出按钮操作 */
     handleExport() {
@@ -506,6 +1194,7 @@ export default {
         "/system/ProductInvoice/importFinancialStatement",
         {
           ...this.queryParams,
+          ids: this.ids,
         },
         `客户销售汇总_${new Date().getTime()}.xlsx`
       );

+ 12 - 8
zkqy-ui/src/views/orderMange/index.vue

@@ -472,7 +472,6 @@
                     <el-select
                       v-model="scope.row.colourNumber"
                       placeholder=""
-                      clearable
                       filterable
                       @change="colourNumberChangeHandler(scope.row)"
                     >
@@ -1381,9 +1380,9 @@ export default {
         productNo: "", //货品编号
         productType: "", //类型
         productName: "", //货品名称
-        productNumber: "", //销售数量
-        productWeight: "", //销售重量kg
-        productUnitPrice: "", //单价
+        productNumber: 0, //销售数量
+        productWeight: 0, //销售重量kg
+        productUnitPrice: 0, //单价
         productAmounts: "", //金额
         sliceType: "", //切片类型
         sliceTypeLabel: "",
@@ -1407,7 +1406,11 @@ export default {
         fieldName,
         this.productionTableData[Number(index)][fieldName]
       );
-      if (!this.productionTableData[Number(index)][fieldName]) {
+      if (
+        !this.productionTableData[Number(index)][fieldName] &&
+        this.productionTableData[Number(index)][fieldName] !== 0 &&
+        this.productionTableData[Number(index)][fieldName] !== "0"
+      ) {
         callback(new Error(message));
       } else {
         callback();
@@ -1612,7 +1615,7 @@ export default {
               btnType: "myEdit",
               btnIcon: "",
               btnShowCondition:
-                '[{"fieldName":"sale_order.status","mark":"3","refValue":"2"},{"fieldName":"sale_order.status","mark":"3","refValue":"3"},{"fieldName":"sale_order.status","mark":"3","refValue":"4"},{"fieldName":"sale_order.status","mark":"3","refValue":"5"},{"fieldName":"sale_order.status","mark":"3","refValue":"6"},{"fieldName":"sale_order.status","mark":"3","refValue":"8"},{"fieldName":"sale_order.status","mark":"3","refValue":"100"},{"fieldName":"sale_order.status","mark":"3","refValue":"101"}]',
+                '[{"fieldName":"sale_order.status","mark":"3","refValue":"2"},{"fieldName":"sale_order.status","mark":"3","refValue":"3"},{"fieldName":"sale_order.status","mark":"3","refValue":"4"},{"fieldName":"sale_order.status","mark":"3","refValue":"5"},{"fieldName":"sale_order.status","mark":"3","refValue":"6"},{"fieldName":"sale_order.status","mark":"3","refValue":"8"},{"fieldName":"sale_order.status","mark":"3","refValue":"9"},{"fieldName":"sale_order.status","mark":"3","refValue":"100"},{"fieldName":"sale_order.status","mark":"3","refValue":"101"}]',
               btnHasPermi: "huaxian:xsglddgl:INSERT",
               children: [],
             },
@@ -1660,7 +1663,7 @@ export default {
               btnType: "myDelete",
               btnIcon: "",
               btnShowCondition:
-                '[{"fieldName":"sale_order.status","mark":"3","refValue":"2"},{"fieldName":"sale_order.status","mark":"3","refValue":"3"},{"fieldName":"sale_order.status","mark":"3","refValue":"4"},{"fieldName":"sale_order.status","mark":"3","refValue":"5"},{"fieldName":"sale_order.status","mark":"3","refValue":"6"},{"fieldName":"sale_order.status","mark":"3","refValue":"8"}]',
+                '[{"fieldName":"sale_order.status","mark":"3","refValue":"2"},{"fieldName":"sale_order.status","mark":"3","refValue":"3"},{"fieldName":"sale_order.status","mark":"3","refValue":"4"},{"fieldName":"sale_order.status","mark":"3","refValue":"5"},{"fieldName":"sale_order.status","mark":"3","refValue":"6"},{"fieldName":"sale_order.status","mark":"3","refValue":"8"},{"fieldName":"sale_order.status","mark":"3","refValue":"9"}]',
               children: [],
               btnHasPermi: "huaxian:xsglddgl:INSERT",
             },
@@ -3363,7 +3366,7 @@ export default {
     // 自定义删除按钮
     async myDeleteHandler(row) {
       console.log(row);
-      let stateArr = ["2", "3", "4", "5", "6", "8"];
+      let stateArr = ["2", "3", "4", "5", "6", "8", "9"];
       let isDeleteValidate = this.selection.some((item) => {
         return stateArr.includes(item.status);
       });
@@ -3471,6 +3474,7 @@ export default {
       let payload = {
         id: row.id,
         status: 6,
+        saleNo: row.saleNo,
       };
       let res = await updateOrder(payload);
       if (res.code == 200) {

+ 4 - 1
zkqy-ui/src/views/orderMange/outStock/index.vue

@@ -338,6 +338,7 @@ export default {
         let payload = {
           isEnablePaging: false,
           status: 1,
+          // status: 55,
         };
         let res = await productInvoiceList(payload);
         if (res.code == 200) {
@@ -349,7 +350,9 @@ export default {
         } else {
           throw new Error(res.msg);
         }
-      } catch (error) {}
+      } catch (error) {
+        console.log(error);
+      }
     },
     // 根据字典获取文件类型
     getdocumentTypeName(value) {

+ 47 - 31
zkqy-ui/src/views/orderMange/retailMange/index.vue

@@ -171,7 +171,7 @@
                 操作<i class="el-icon-arrow-down el-icon--right"></i>
               </el-button>
               <el-dropdown-menu slot="dropdown">
-                <el-dropdown-item>
+                <el-dropdown-item v-show="scope.row.status != 6">
                   <el-button
                     size="mini"
                     type="text"
@@ -211,7 +211,7 @@
                     >提交
                   </el-button>
                 </el-dropdown-item> -->
-                <el-dropdown-item v-show="scope.row.status == 5">
+                <!-- <el-dropdown-item v-show="scope.row.status == 5">
                   <el-button
                     size="mini"
                     type="text"
@@ -220,7 +220,7 @@
                     @click="handleSubmitCancel(scope.row)"
                     >撤销
                   </el-button>
-                </el-dropdown-item>
+                </el-dropdown-item> -->
                 <el-dropdown-item v-show="scope.row.status != 1">
                   <el-button
                     size="mini"
@@ -239,7 +239,7 @@
                     >打印出库单
                   </el-button>
                 </el-dropdown-item>
-                <el-dropdown-item v-show="scope.row.status == 1">
+                <el-dropdown-item v-show="scope.row.status != 6">
                   <el-button
                     size="mini"
                     type="text"
@@ -265,7 +265,7 @@
       <!-- 添加或修改销售出库单:- 过磅记录生成数据对话框 -->
       <el-dialog
         :title="title"
-        width="1100px"
+        width="1400px"
         :visible.sync="open"
         append-to-body
       >
@@ -503,7 +503,7 @@
                   </el-select>
                 </template>
               </el-table-column>
-              <el-table-column prop="colourNumber" label="色号">
+              <el-table-column prop="colourNumber" width="150" label="色号">
                 <template slot-scope="scope">
                   <el-form-item
                     :prop="'colourNumber-' + scope.$index"
@@ -538,7 +538,7 @@
               <el-table-column prop="productType" label="类型">
               </el-table-column>
 
-              <el-table-column prop="lotNumber" label="批号">
+              <el-table-column prop="lotNumber" width="120" label="批号">
                 <template slot-scope="scope">
                   <el-input
                     v-model="scope.row.lotNumber"
@@ -1114,6 +1114,7 @@ export default {
       let payload = {
         id: row.id,
         status: 6,
+        saleNo: row.saleNo,
       };
       let res = await updateOrder(payload);
       if (res.code == 200) {
@@ -1138,13 +1139,31 @@ export default {
         lotNumber,
         productName,
         productSpecifications,
+        colourNumber,
+        specificationsList,
       } = row;
+      let productColour = "";
+      let targetColor = this.colourNumberOptions.find((item) => {
+        return item.materielCode == colourNumber;
+      });
+      let productId = "";
+      if (specificationsList && specificationsList.length > 0) {
+        let targetItem = specificationsList.find(
+          (item) => item.productSpecifications == productSpecifications
+        );
+        productId = targetItem.id;
+      }
+      if (targetColor) {
+        productColour =
+          targetColor.materieEncoding + "" + targetColor.materieColorNumber;
+      }
       let payload = {
-        productNo,
+        productId,
         productType,
-        lotNumber,
+        lotNum: lotNumber,
         productName,
         productSpecifications,
+        productColour,
       };
       let res = await getProductInventory(payload);
       if ((res.code = 200)) {
@@ -1412,9 +1431,9 @@ export default {
         productType: "", //类型
         lotNumber: "", //批号
         productName: "", //货品名称
-        productNumber: "", //销售数量
+        productNumber: 0, //销售数量
         productWeight: "", //销售重量kg
-        productUnitPrice: "", //单价
+        productUnitPrice: 0, //单价
         productAmounts: "", //金额
         sliceType: "022", //切片类型  初始为  切片
         sliceTypeLabel: "",
@@ -1441,7 +1460,11 @@ export default {
         this.productionTableData[Number(index)][fieldName]
       );
       console.log(this.productionTableData);
-      if (!this.productionTableData[Number(index)][fieldName]) {
+      if (
+        !this.productionTableData[Number(index)][fieldName] &&
+        this.productionTableData[Number(index)][fieldName] !== 0 &&
+        this.productionTableData[Number(index)][fieldName] !== "0"
+      ) {
         callback(new Error(message));
       } else {
         callback();
@@ -1812,7 +1835,6 @@ export default {
             payload.orderType = 1;
             let res = await addRetailOrder(payload);
             if (res.code == 200) {
-              this.$message.success("添加成功");
               // 准备新增时 提交  数据 start
               this.form.noticeNumber = this.getOrderNo();
               this.form.status = 5;
@@ -2409,33 +2431,33 @@ export default {
             <div style="text-align:center;">销售合同审计单</div>
             <tbody>
                 <tr>
-                    <td width="600px" colspan="5">合同号:${saleNo}</td>
-                    <td width="600px" colspan="6">日期:${saleDate.replace(
+                    <td width="600px" colspan="4">合同号:${saleNo}</td>
+                    <td width="600px" colspan="5">日期:${saleDate.replace(
                       "T",
                       " "
                     )}</td>
                 </tr>
                 <tr align="center">
-                    <td width="300px" colspan="3">客户名称:</td>
+                    <td width="300px" colspan="2">客户名称:</td>
                     <td width="300px" colspan="3">${customerName}</td>
                     <td colspan="2">业务员:</td>
-                    <td colspan="3">${salesman}</td>
+                    <td colspan="2">${salesman}</td>
 
                 </tr>
                 <tr align="center">
-                    <td width="300px" colspan="3">客户地址:</td>
+                    <td width="300px" colspan="2">客户地址:</td>
                     <td width="300px" colspan="3">${customAddress}</td>
                     <td width="300px" colspan="2">客户国别:</td>
-                    <td width="300px" colspan="3">${customCountryType}</td>
+                    <td width="300px" colspan="2">${customCountryType}</td>
                 </tr>
                 <tr align="center">
-                    <td width="300px" colspan="3">联系人:</td>
-                    <td width="150px" colspan="3">${contactPerson}</td>
+                    <td width="300px" colspan="2">联系人:</td>
+                    <td width="150px" colspan="2">${contactPerson}</td>
                     <td  colspan="2">合计金额(大写):</td>
                     <td colspan="3">${saleAmountInWords}</td>
                 </tr>
                 <tr align="center">
-                    <td colspan="11">货品明细</td>
+                    <td colspan="9">货品明细</td>
                 </tr>
                 <tr align="center">
                     <td width="150px">品名</td>
@@ -2446,8 +2468,6 @@ export default {
                     <td width="100px">箱数</td>
                     <td width="100px">单价</td>
                     <td width="100px">金额</td>
-                    <td width="100px">库存箱数</td>
-                    <td width="150px">库存重量/kg</td>
                     <td width="100px">备注</td>
                 </tr>`;
       let amountTotal = 0,
@@ -2478,8 +2498,6 @@ export default {
                     <td>${item.productNumber}</td>
                     <td>${item.productUnitPrice}</td>
                     <td>${item.productAmounts}</td>
-                    <td>${item.inventoryBoxNum}</td>
-                    <td>${item.inventoryWeight}</td>
                     <td>${item.remark}</td>
                 </tr>`;
       }
@@ -2498,11 +2516,9 @@ export default {
           <td>${singlTotal}</td>
           <td>${moneyTotal}</td>
           <td></td>
-          <td></td>
-          <td></td>
         </tr>`;
       printStr += `<tr align="left">
-                    <td colspan="11">订单备注:${orderRemark}</td>
+                    <td colspan="9">订单备注:${orderRemark}</td>
                 </tr>
                 </tbody>
         </table>`;
@@ -3377,14 +3393,14 @@ export default {
     // 自定义删除按钮
     async myDeleteHandler(row) {
       console.log(row);
-      let stateArr = ["2", "3", "4", "5", "6", "8"];
+      let stateArr = ["6"];
       let isDeleteValidate = this.selection.some((item) => {
         return stateArr.includes(item.status);
       });
       console.log(this.selection);
       console.log(isDeleteValidate);
       if (isDeleteValidate) {
-        this.$message.error("仅允许删除订单状态为'未提交'或'未通过'的订单");
+        this.$message.error("'已完成'状态订单不可删除!");
         return;
       }
       await this.$confirm("是否确认删除选中的数据?", "警告", {