Procházet zdrojové kódy

Merge remote-tracking branch 'origin/master'

hmc před 1 rokem
rodič
revize
51996dc4b9

+ 8 - 5
zkqy-common/src/main/java/com/zkqy/common/utils/poi/ExcelUtil.java

@@ -1160,12 +1160,15 @@ public class ExcelUtil<T> {
                 if (hearKeys.size() < fields.size()) {  // 设置表头最后一个单元格夸列
                     int difference = Math.abs(hearKeys.size() - fields.size());
                     CellRangeAddress cellRange = new CellRangeAddress(i, i, hearKeys.size() - 1, fields.size() - 1);
+
                     sheet.addMergedRegion(cellRange);
-                    // 合并后,设置合并区域的边框样式
-                    RegionUtil.setBorderBottom(BorderStyle.THIN, cellRange, sheet);
-                    RegionUtil.setBorderTop(BorderStyle.THIN, cellRange, sheet);
-                    RegionUtil.setBorderLeft(BorderStyle.THIN, cellRange, sheet);
-                    RegionUtil.setBorderRight(BorderStyle.THIN, cellRange, sheet);
+                    // 合并后,设置合并区域的边框样式 -》 如果只有一个标题单元格不设置边框
+                    if (hearKeys.size() > 1) {
+                        RegionUtil.setBorderBottom(BorderStyle.THIN, cellRange, sheet);
+                        RegionUtil.setBorderTop(BorderStyle.THIN, cellRange, sheet);
+                        RegionUtil.setBorderLeft(BorderStyle.THIN, cellRange, sheet);
+                        RegionUtil.setBorderRight(BorderStyle.THIN, cellRange, sheet);
+                    }
                 }
                 integerStringMap.clear();
             }

+ 46 - 31
zkqy-custom-business/src/main/java/com/zkqy/business/controller/ProductInvoiceController.java

@@ -1,17 +1,15 @@
 package com.zkqy.business.controller;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import javax.servlet.http.HttpServletResponse;
 
-import com.zkqy.common.core.domain.entity.SysRole;
-import com.zkqy.common.utils.SecurityUtils;
+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;
@@ -31,19 +29,17 @@ import com.zkqy.common.core.page.TableDataInfo;
 @RestController
 @RequestMapping("/system/ProductInvoice")
 @Api(value = "/system/ProductInvoice", description = "产品发货单-接口")
-public class ProductInvoiceController extends BaseController
-{
+public class ProductInvoiceController extends BaseController {
     @Autowired
     private IProductInvoiceService productInvoiceService;
 
-/**
- * 查询产品发货单列表
- */
+    /**
+     * 查询产品发货单列表
+     */
 //@PreAuthorize("@ss.hasPermi('system:ProductInvoice:list')")
-@GetMapping("/list")
-@ApiOperation(value = "查询产品发货单列表")
-    public TableDataInfo list(ProductInvoice productInvoice)
-    {
+    @GetMapping("/list")
+    @ApiOperation(value = "查询产品发货单列表")
+    public TableDataInfo list(ProductInvoice productInvoice) {
         startPage();
         List<ProductInvoice> list = productInvoiceService.selectProductInvoiceList(productInvoice);
         return getDataTable(list);
@@ -56,8 +52,7 @@ public class ProductInvoiceController extends BaseController
     @Log(title = "产品发货单", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     @ApiOperation(value = "导出产品发货单列表")
-    public void export(HttpServletResponse response, ProductInvoice productInvoice)
-    {
+    public void export(HttpServletResponse response, ProductInvoice productInvoice) {
         List<ProductInvoice> list = productInvoiceService.selectProductInvoiceList(productInvoice);
         ExcelUtil<ProductInvoice> util = new ExcelUtil<ProductInvoice>(ProductInvoice.class);
         util.exportExcel(response, list, "产品发货单数据");
@@ -69,8 +64,7 @@ public class ProductInvoiceController extends BaseController
 //    @PreAuthorize("@ss.hasPermi('system:ProductInvoice:query')")
     @GetMapping(value = "/{id}")
     @ApiOperation(value = "获取产品发货单详细信息")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
         return success(productInvoiceService.selectProductInvoiceById(id));
     }
 
@@ -81,8 +75,7 @@ public class ProductInvoiceController extends BaseController
     @Log(title = "产品发货单", businessType = BusinessType.INSERT)
     @PostMapping
     @ApiOperation(value = "新增产品发货单")
-    public AjaxResult add(@RequestBody ProductInvoice productInvoice)
-    {
+    public AjaxResult add(@RequestBody ProductInvoice productInvoice) {
         return toAjax(productInvoiceService.insertProductInvoice(productInvoice));
     }
 
@@ -93,8 +86,7 @@ public class ProductInvoiceController extends BaseController
     @Log(title = "产品发货单", businessType = BusinessType.UPDATE)
     @PutMapping
     @ApiOperation(value = "修改产品发货单")
-    public AjaxResult edit(@RequestBody ProductInvoice productInvoice)
-    {
+    public AjaxResult edit(@RequestBody ProductInvoice productInvoice) {
         return toAjax(productInvoiceService.updateProductInvoice(productInvoice));
     }
 
@@ -105,8 +97,7 @@ public class ProductInvoiceController extends BaseController
     @Log(title = "产品发货单", businessType = BusinessType.DELETE)
     @DeleteMapping("/{ids}")
     @ApiOperation(value = "删除产品发货单")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
+    public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(productInvoiceService.deleteProductInvoiceByIds(ids));
     }
 
@@ -114,8 +105,7 @@ public class ProductInvoiceController extends BaseController
      * 查询发货单货品信息/销售单&零售单
      */
     @GetMapping("/productInvoiceInfo")
-    public AjaxResult productInvoiceInfo(@RequestParam("saleOrderNo") String saleOrderNo)
-    {
+    public AjaxResult productInvoiceInfo(@RequestParam("saleOrderNo") String saleOrderNo) {
         return success(productInvoiceService.productInvoiceInfo(saleOrderNo));
     }
 
@@ -123,8 +113,7 @@ public class ProductInvoiceController extends BaseController
      * 查询发货单货品信息
      */
     @GetMapping("/saleStorageDetails")
-    public AjaxResult saleStorageDetails(@RequestParam("id") Long id)
-    {
+    public AjaxResult saleStorageDetails(@RequestParam("id") Long id) {
         return success(productInvoiceService.saleStorageDetails(id));
     }
 
@@ -132,9 +121,35 @@ public class ProductInvoiceController extends BaseController
      * 打印发货单、送货单、财务对账单接口
      */
     @GetMapping("/printDocuments")
-    public AjaxResult printDocuments(@RequestParam("id") Long id)
-    {
+    public AjaxResult printDocuments(@RequestParam("id") Long id) {
         return success(productInvoiceService.printDocuments(id));
     }
 
+    @GetMapping("/financialStatementList")
+    @ApiOperation(value = "查询财务对账单列表")
+    public TableDataInfo financialStatementList(ProductInvoiceFinancialExportVo productInvoiceFinancialExportVo) {
+        startPage();
+        List<Map<String, Object>> list = new ArrayList<>();
+        if (productInvoiceFinancialExportVo.getOrderType().equals("retailOrder")) {  // 零售单
+            list.addAll(productInvoiceService.financialStatementList(productInvoiceFinancialExportVo));
+        } else if (productInvoiceFinancialExportVo.getOrderType().equals("contractOrder")) {  // 合同单
+            list.addAll(productInvoiceService.financialStatementList(productInvoiceFinancialExportVo));
+        }
+        return getDataTable(list);
+    }
+
+    @PostMapping("/importFinancialStatement")
+    public void importDataOutboundDetails(HttpServletResponse response, ProductInvoiceFinancialExportVo productInvoiceFinancialExportVo) {
+        // 查询需要需要导出的待物对账单
+        List<ProductInvoiceFinancialExportVo> list = productInvoiceService.financialStatementExportList(productInvoiceFinancialExportVo);
+        if (list.size() != 0) {
+            ExcelUtil<ProductInvoiceFinancialExportVo> util = new ExcelUtil<ProductInvoiceFinancialExportVo>(ProductInvoiceFinancialExportVo.class);
+            Map<Integer, String> map = new HashMap<>();
+            map.put(0, "销售客户汇总");
+            List<Map<Integer, String>> mapList = new ArrayList<>();
+            mapList.add(map);
+            util.addCustomHeaderData(mapList);
+            util.exportExcel(response, list, "出库明细");
+        }
+    }
 }

+ 192 - 151
zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductInvoice.java

@@ -1,6 +1,7 @@
 package com.zkqy.business.domain;
 
 import java.util.Date;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.zkqy.common.core.domain.BaseEntity;
 import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -9,312 +10,352 @@ import com.zkqy.common.annotation.Excel;
 
 /**
  * 产品发货单对象 product_invoice
- * 
+ *
  * @author zkqy
  * @date 2024-04-11
  */
-public class ProductInvoice extends BaseEntity
-{
+public class ProductInvoice extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 编号 */
+    private String orderType;
+
+    public String getOrderType() {
+        return orderType;
+    }
+
+    public void setOrderType(String orderType) {
+        this.orderType = orderType;
+    }
+
+    /**
+     * 编号
+     */
     private Long id;
 
-    /** 通知单号 */
+    /**
+     * 通知单号
+     */
     @Excel(name = "通知单号")
     private String noticeNumber;
 
-    /** 通知日期 */
+    /**
+     * 通知日期
+     */
     @JsonFormat(pattern = "yyyy-MM-dd")
     @Excel(name = "通知日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date noticeDate;
 
-    /** 销售员 */
+    /**
+     * 销售员
+     */
     @Excel(name = "销售员")
     private String salesman;
 
-    /** 客户编号 */
+    /**
+     * 客户编号
+     */
     @Excel(name = "客户编号")
     private Long customerId;
 
-    /** 客户名称 */
+    /**
+     * 客户名称
+     */
     private String customerName;
 
-    /** 开票员 */
+    /**
+     * 开票员
+     */
     @Excel(name = "开票员")
     private String drawer;
 
-    /** 发货单备注 */
+    /**
+     * 发货单备注
+     */
     @Excel(name = "发货单备注")
     private String dispatchNoteRemark;
 
-    /** 开票类型 */
+    /**
+     * 开票类型
+     */
     @Excel(name = "开票类型")
     private String billingType;
 
-    /** 货车登记 */
+    /**
+     * 货车登记
+     */
     @Excel(name = "货车登记")
     private String truckRegistration;
 
-    /** 单据类型 */
+    /**
+     * 单据类型
+     */
     @Excel(name = "单据类型")
     private String documentType;
 
-    /** 售货单位 */
+    /**
+     * 售货单位
+     */
     @Excel(name = "售货单位")
     private String sellingUnit;
 
-    /** 计算类型(未启用) */
+    /**
+     * 计算类型(未启用)
+     */
     @Excel(name = "计算类型", readConverterExp = "未=启用")
     private String calculationType;
 
-    /** 审核意见 */
+    /**
+     * 审核意见
+     */
     @Excel(name = "审核意见")
     private String auditOpinion;
 
-    /** 状态 */
+    /**
+     * 状态
+     */
     @Excel(name = "状态")
     private String status;
 
-    /** 销售单合同号 */
+    /**
+     * 销售单合同号
+     */
     @Excel(name = "销售单合同号")
     private String saleOrderNo;
 
-    /** 备用列 */
+    /**
+     * 备用列
+     */
     @Excel(name = "备用列")
     private String spare1;
 
-    /** 备用列 */
+    /**
+     * 备用列
+     */
     @Excel(name = "备用列")
     private String spare2;
 
-    /** 备用列 */
+    /**
+     * 备用列
+     */
     @Excel(name = "备用列")
     private String spare3;
 
-    /** 备用列 */
+    /**
+     * 备用列
+     */
     @Excel(name = "备用列")
     private String spare4;
 
-    /** 删除标志(0:否;2:是) */
+    /**
+     * 删除标志(0:否;2:是)
+     */
     private String delFlag;
 
-    /** 创建者ID */
+    /**
+     * 创建者ID
+     */
     private Long createById;
 
-    /** 修改者ID */
+    /**
+     * 修改者ID
+     */
     private Long updateById;
 
-    /** 发货仓库 */
+    /**
+     * 发货仓库
+     */
     private Long deliveryWarehouse;
 
-    /** 调拨仓库 */
+    /**
+     * 调拨仓库
+     */
     private Long transferWarehouse;
 
-    /** 发货日期 */
+    /**
+     * 发货日期
+     */
     @JsonFormat(pattern = "yyyy-MM-dd")
     @Excel(name = "发货日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date deliveryDate;
 
-    /** 发货员 */
+    /**
+     * 发货员
+     */
     private String deliveryClerk;
 
-    public void setId(Long id) 
-    {
+    public void setId(Long id) {
         this.id = id;
     }
 
-    public Long getId() 
-    {
+    public Long getId() {
         return id;
     }
-    public void setNoticeNumber(String noticeNumber) 
-    {
+
+    public void setNoticeNumber(String noticeNumber) {
         this.noticeNumber = noticeNumber;
     }
 
-    public String getNoticeNumber() 
-    {
+    public String getNoticeNumber() {
         return noticeNumber;
     }
-    public void setNoticeDate(Date noticeDate) 
-    {
+
+    public void setNoticeDate(Date noticeDate) {
         this.noticeDate = noticeDate;
     }
 
-    public Date getNoticeDate() 
-    {
+    public Date getNoticeDate() {
         return noticeDate;
     }
-    public void setSalesman(String salesman) 
-    {
+
+    public void setSalesman(String salesman) {
         this.salesman = salesman;
     }
 
-    public String getSalesman() 
-    {
+    public String getSalesman() {
         return salesman;
     }
-    public void setCustomerId(Long customerId) 
-    {
+
+    public void setCustomerId(Long customerId) {
         this.customerId = customerId;
     }
 
-    public Long getCustomerId() 
-    {
+    public Long getCustomerId() {
         return customerId;
     }
-    public void setDrawer(String drawer) 
-    {
+
+    public void setDrawer(String drawer) {
         this.drawer = drawer;
     }
 
-    public String getDrawer() 
-    {
+    public String getDrawer() {
         return drawer;
     }
-    public void setDispatchNoteRemark(String dispatchNoteRemark) 
-    {
+
+    public void setDispatchNoteRemark(String dispatchNoteRemark) {
         this.dispatchNoteRemark = dispatchNoteRemark;
     }
 
-    public String getDispatchNoteRemark() 
-    {
+    public String getDispatchNoteRemark() {
         return dispatchNoteRemark;
     }
-    public void setBillingType(String billingType) 
-    {
+
+    public void setBillingType(String billingType) {
         this.billingType = billingType;
     }
 
-    public String getBillingType() 
-    {
+    public String getBillingType() {
         return billingType;
     }
-    public void setTruckRegistration(String truckRegistration) 
-    {
+
+    public void setTruckRegistration(String truckRegistration) {
         this.truckRegistration = truckRegistration;
     }
 
-    public String getTruckRegistration() 
-    {
+    public String getTruckRegistration() {
         return truckRegistration;
     }
-    public void setDocumentType(String documentType) 
-    {
+
+    public void setDocumentType(String documentType) {
         this.documentType = documentType;
     }
 
-    public String getDocumentType() 
-    {
+    public String getDocumentType() {
         return documentType;
     }
-    public void setSellingUnit(String sellingUnit) 
-    {
+
+    public void setSellingUnit(String sellingUnit) {
         this.sellingUnit = sellingUnit;
     }
 
-    public String getSellingUnit() 
-    {
+    public String getSellingUnit() {
         return sellingUnit;
     }
-    public void setCalculationType(String calculationType) 
-    {
+
+    public void setCalculationType(String calculationType) {
         this.calculationType = calculationType;
     }
 
-    public String getCalculationType() 
-    {
+    public String getCalculationType() {
         return calculationType;
     }
-    public void setAuditOpinion(String auditOpinion) 
-    {
+
+    public void setAuditOpinion(String auditOpinion) {
         this.auditOpinion = auditOpinion;
     }
 
-    public String getAuditOpinion() 
-    {
+    public String getAuditOpinion() {
         return auditOpinion;
     }
-    public void setStatus(String status) 
-    {
+
+    public void setStatus(String status) {
         this.status = status;
     }
 
-    public String getStatus() 
-    {
+    public String getStatus() {
         return status;
     }
-    public void setSaleOrderNo(String saleOrderNo) 
-    {
+
+    public void setSaleOrderNo(String saleOrderNo) {
         this.saleOrderNo = saleOrderNo;
     }
 
-    public String getSaleOrderNo() 
-    {
+    public String getSaleOrderNo() {
         return saleOrderNo;
     }
-    public void setSpare1(String spare1) 
-    {
+
+    public void setSpare1(String spare1) {
         this.spare1 = spare1;
     }
 
-    public String getSpare1() 
-    {
+    public String getSpare1() {
         return spare1;
     }
-    public void setSpare2(String spare2) 
-    {
+
+    public void setSpare2(String spare2) {
         this.spare2 = spare2;
     }
 
-    public String getSpare2() 
-    {
+    public String getSpare2() {
         return spare2;
     }
-    public void setSpare3(String spare3) 
-    {
+
+    public void setSpare3(String spare3) {
         this.spare3 = spare3;
     }
 
-    public String getSpare3() 
-    {
+    public String getSpare3() {
         return spare3;
     }
-    public void setSpare4(String spare4) 
-    {
+
+    public void setSpare4(String spare4) {
         this.spare4 = spare4;
     }
 
-    public String getSpare4() 
-    {
+    public String getSpare4() {
         return spare4;
     }
-    public void setDelFlag(String delFlag) 
-    {
+
+    public void setDelFlag(String delFlag) {
         this.delFlag = delFlag;
     }
 
-    public String getDelFlag() 
-    {
+    public String getDelFlag() {
         return delFlag;
     }
-    public void setCreateById(Long createById) 
-    {
+
+    public void setCreateById(Long createById) {
         this.createById = createById;
     }
 
-    public Long getCreateById() 
-    {
+    public Long getCreateById() {
         return createById;
     }
-    public void setUpdateById(Long updateById) 
-    {
+
+    public void setUpdateById(Long updateById) {
         this.updateById = updateById;
     }
 
-    public Long getUpdateById() 
-    {
+    public Long getUpdateById() {
         return updateById;
     }
 
@@ -360,38 +401,38 @@ public class ProductInvoice extends BaseEntity
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("noticeNumber", getNoticeNumber())
-            .append("noticeDate", getNoticeDate())
-            .append("salesman", getSalesman())
-            .append("customerId", getCustomerId())
-            .append("customerName", getCustomerName())
-            .append("drawer", getDrawer())
-            .append("dispatchNoteRemark", getDispatchNoteRemark())
-            .append("billingType", getBillingType())
-            .append("truckRegistration", getTruckRegistration())
-            .append("documentType", getDocumentType())
-            .append("sellingUnit", getSellingUnit())
-            .append("calculationType", getCalculationType())
-            .append("auditOpinion", getAuditOpinion())
-            .append("status", getStatus())
-            .append("saleOrderNo", getSaleOrderNo())
-            .append("spare1", getSpare1())
-            .append("spare2", getSpare2())
-            .append("spare3", getSpare3())
-            .append("spare4", getSpare4())
-            .append("remark", getRemark())
-            .append("delFlag", getDelFlag())
-            .append("createBy", getCreateBy())
-            .append("createById", getCreateById())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateById", getUpdateById())
-            .append("updateTime", getUpdateTime())
-            .append("deliveryWarehouse", getDeliveryWarehouse())
-            .append("transferWarehouse", getTransferWarehouse())
-            .append("deliveryDate", getDeliveryDate())
-            .toString();
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("id", getId())
+                .append("noticeNumber", getNoticeNumber())
+                .append("noticeDate", getNoticeDate())
+                .append("salesman", getSalesman())
+                .append("customerId", getCustomerId())
+                .append("customerName", getCustomerName())
+                .append("drawer", getDrawer())
+                .append("dispatchNoteRemark", getDispatchNoteRemark())
+                .append("billingType", getBillingType())
+                .append("truckRegistration", getTruckRegistration())
+                .append("documentType", getDocumentType())
+                .append("sellingUnit", getSellingUnit())
+                .append("calculationType", getCalculationType())
+                .append("auditOpinion", getAuditOpinion())
+                .append("status", getStatus())
+                .append("saleOrderNo", getSaleOrderNo())
+                .append("spare1", getSpare1())
+                .append("spare2", getSpare2())
+                .append("spare3", getSpare3())
+                .append("spare4", getSpare4())
+                .append("remark", getRemark())
+                .append("delFlag", getDelFlag())
+                .append("createBy", getCreateBy())
+                .append("createById", getCreateById())
+                .append("createTime", getCreateTime())
+                .append("updateBy", getUpdateBy())
+                .append("updateById", getUpdateById())
+                .append("updateTime", getUpdateTime())
+                .append("deliveryWarehouse", getDeliveryWarehouse())
+                .append("transferWarehouse", getTransferWarehouse())
+                .append("deliveryDate", getDeliveryDate())
+                .toString();
     }
 }

+ 176 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/ProductInvoiceFinancialExportVo.java

@@ -0,0 +1,176 @@
+package com.zkqy.business.domain.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.zkqy.common.annotation.Excel;
+import com.zkqy.common.core.domain.BaseEntity;
+
+import java.util.Date;
+
+/**
+ * 财务对账单导出
+ */
+public class ProductInvoiceFinancialExportVo extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 客户名称
+     */
+    @Excel(name = "客户名称")
+    private String customName;
+    /**
+     * 产品名称
+     */
+    @Excel(name = "产品名称")
+    private String productName;
+    /**
+     * 产品规格
+     */
+    @Excel(name = "规格")
+    private String productSpecifications;
+    /**
+     * 产品等级
+     */
+    @Excel(name = "产品等级")
+    private String levels;
+    /**
+     * 批号
+     */
+    @Excel(name = "批号")
+    private String lotNum;
+    /**
+     * 色泽
+     */
+    @Excel(name = "色泽")
+    private String productColour;
+
+    /**
+     * 重量
+     */
+    @Excel(name = "重量", isStatistics = true, scale = 2)
+    private String suttle;
+
+    /**
+     * 导出类型  合同单contractOrder / 零售单retailOrder
+     */
+    private String orderType;
+
+    /**
+     * 通知单号
+     */
+    private String noticeNumber;
+
+    /**
+     * 客户编号
+     */
+    private Long customerId;
+
+    /**
+     * 通知日期
+     */
+    private Date noticeDate;
+
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder("ProductInvoiceFinancialExportVo{");
+        sb.append("customName='").append(customName).append('\'');
+        sb.append(", productName='").append(productName).append('\'');
+        sb.append(", productSpecifications='").append(productSpecifications).append('\'');
+        sb.append(", levels='").append(levels).append('\'');
+        sb.append(", lotNum='").append(lotNum).append('\'');
+        sb.append(", productColour='").append(productColour).append('\'');
+        sb.append(", suttle='").append(suttle).append('\'');
+        sb.append(", orderType='").append(orderType).append('\'');
+        sb.append(", noticeNumber='").append(noticeNumber).append('\'');
+        sb.append(", customerId=").append(customerId);
+        sb.append(", noticeDate=").append(noticeDate);
+        sb.append('}');
+        return sb.toString();
+    }
+
+    public String getCustomName() {
+        return customName;
+    }
+
+    public void setCustomName(String customName) {
+        this.customName = customName;
+    }
+
+    public String getProductName() {
+        return productName;
+    }
+
+    public void setProductName(String productName) {
+        this.productName = productName;
+    }
+
+    public String getProductSpecifications() {
+        return productSpecifications;
+    }
+
+    public void setProductSpecifications(String productSpecifications) {
+        this.productSpecifications = productSpecifications;
+    }
+
+    public String getLevels() {
+        return levels;
+    }
+
+    public void setLevels(String levels) {
+        this.levels = levels;
+    }
+
+    public String getLotNum() {
+        return lotNum;
+    }
+
+    public void setLotNum(String lotNum) {
+        this.lotNum = lotNum;
+    }
+
+    public String getProductColour() {
+        return productColour;
+    }
+
+    public void setProductColour(String productColour) {
+        this.productColour = productColour;
+    }
+
+    public String getSuttle() {
+        return suttle;
+    }
+
+    public void setSuttle(String suttle) {
+        this.suttle = suttle;
+    }
+
+    public String getOrderType() {
+        return orderType;
+    }
+
+    public void setOrderType(String orderType) {
+        this.orderType = orderType;
+    }
+
+    public String getNoticeNumber() {
+        return noticeNumber;
+    }
+
+    public void setNoticeNumber(String noticeNumber) {
+        this.noticeNumber = noticeNumber;
+    }
+
+    public Long getCustomerId() {
+        return customerId;
+    }
+
+    public void setCustomerId(Long customerId) {
+        this.customerId = customerId;
+    }
+
+    public Date getNoticeDate() {
+        return noticeDate;
+    }
+
+    public void setNoticeDate(Date noticeDate) {
+        this.noticeDate = noticeDate;
+    }
+}

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

@@ -1,19 +1,21 @@
 package com.zkqy.business.mapper;
 
 import java.util.List;
+import java.util.Map;
+
 import com.zkqy.business.domain.ProductInvoice;
+import com.zkqy.business.domain.vo.ProductInvoiceFinancialExportVo;
 
 /**
  * 产品发货单Mapper接口
- * 
+ *
  * @author zkqy
  * @date 2024-04-11
  */
-public interface ProductInvoiceMapper 
-{
+public interface ProductInvoiceMapper {
     /**
      * 查询产品发货单
-     * 
+     *
      * @param id 产品发货单主键
      * @return 产品发货单
      */
@@ -21,7 +23,7 @@ public interface ProductInvoiceMapper
 
     /**
      * 查询产品发货单列表
-     * 
+     *
      * @param productInvoice 产品发货单
      * @return 产品发货单集合
      */
@@ -29,7 +31,7 @@ public interface ProductInvoiceMapper
 
     /**
      * 新增产品发货单
-     * 
+     *
      * @param productInvoice 产品发货单
      * @return 结果
      */
@@ -37,7 +39,7 @@ public interface ProductInvoiceMapper
 
     /**
      * 修改产品发货单
-     * 
+     *
      * @param productInvoice 产品发货单
      * @return 结果
      */
@@ -45,7 +47,7 @@ public interface ProductInvoiceMapper
 
     /**
      * 删除产品发货单
-     * 
+     *
      * @param id 产品发货单主键
      * @return 结果
      */
@@ -53,7 +55,7 @@ public interface ProductInvoiceMapper
 
     /**
      * 批量删除产品发货单
-     * 
+     *
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
@@ -74,4 +76,20 @@ public interface ProductInvoiceMapper
      * @return 结果
      */
     int deleteProductInvoiceBySaleOrderNo(String saleOrderNo);
+
+    /**
+     * 查询财务对账单列表 -》导出
+     *
+     * @param productInvoiceFinancialExportVo 财务对账单
+     * @return 对账列表集合
+     */
+    public List<Map<String, Object>> financialStatementList(ProductInvoiceFinancialExportVo productInvoiceFinancialExportVo);
+
+    /**
+     * 查询财务对账单列表
+     *
+     * @param productInvoiceFinancialExportVo 财务对账单
+     * @return 对账列表集合
+     */
+    public List<ProductInvoiceFinancialExportVo> financialStatementExportList(ProductInvoiceFinancialExportVo productInvoiceFinancialExportVo);
 }

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

@@ -5,19 +5,19 @@ import java.util.Map;
 
 import com.zkqy.business.domain.ProductInventory;
 import com.zkqy.business.domain.ProductInvoice;
+import com.zkqy.business.domain.vo.ProductInvoiceFinancialExportVo;
 import com.zkqy.business.domain.vo.ProductInvoiceVO;
 
 /**
  * 产品发货单Service接口
- * 
+ *
  * @author zkqy
  * @date 2024-04-11
  */
-public interface IProductInvoiceService 
-{
+public interface IProductInvoiceService {
     /**
      * 查询产品发货单
-     * 
+     *
      * @param id 产品发货单主键
      * @return 产品发货单
      */
@@ -25,7 +25,7 @@ public interface IProductInvoiceService
 
     /**
      * 查询产品发货单列表
-     * 
+     *
      * @param productInvoice 产品发货单
      * @return 产品发货单集合
      */
@@ -33,7 +33,7 @@ public interface IProductInvoiceService
 
     /**
      * 新增产品发货单
-     * 
+     *
      * @param productInvoice 产品发货单
      * @return 结果
      */
@@ -41,7 +41,7 @@ public interface IProductInvoiceService
 
     /**
      * 修改产品发货单
-     * 
+     *
      * @param productInvoice 产品发货单
      * @return 结果
      */
@@ -49,7 +49,7 @@ public interface IProductInvoiceService
 
     /**
      * 批量删除产品发货单
-     * 
+     *
      * @param ids 需要删除的产品发货单主键集合
      * @return 结果
      */
@@ -57,7 +57,7 @@ public interface IProductInvoiceService
 
     /**
      * 删除产品发货单信息
-     * 
+     *
      * @param id 产品发货单主键
      * @return 结果
      */
@@ -65,6 +65,7 @@ public interface IProductInvoiceService
 
     /**
      * 查询发货单详情/销售单
+     *
      * @param saleOrderNo 销售单编号
      * @return
      */
@@ -72,6 +73,7 @@ public interface IProductInvoiceService
 
     /**
      * 查询通知单货品信息
+     *
      * @param id 通知单编号
      * @return
      */
@@ -87,10 +89,26 @@ public interface IProductInvoiceService
 
     /**
      * 打印发货单、送货单、财务对账单接口
+     *
      * @return
      */
     ProductInvoiceVO printDocuments(Long id);
 
+    /**
+     * 查询财务对账单列表-》导出
+     *
+     * @param productInvoiceFinancialExportVo 财务对账单
+     * @return 对账列表集合
+     */
+    public List<Map<String, Object>>  financialStatementList(ProductInvoiceFinancialExportVo productInvoiceFinancialExportVo);
+
+    /**
+     * 查询财务对账单列表
+     *
+     * @param productInvoiceFinancialExportVo 财务对账单
+     * @return 对账列表集合
+     */
+    public List<ProductInvoiceFinancialExportVo> financialStatementExportList(ProductInvoiceFinancialExportVo productInvoiceFinancialExportVo);
 
 
 }

+ 77 - 73
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductInvoiceServiceImpl.java

@@ -8,6 +8,7 @@ import java.util.stream.Collectors;
 
 import com.zkqy.business.domain.*;
 import com.zkqy.business.domain.vo.ProductCodeListVO;
+import com.zkqy.business.domain.vo.ProductInvoiceFinancialExportVo;
 import com.zkqy.business.domain.vo.ProductInvoiceVO;
 import com.zkqy.business.mapper.*;
 import com.zkqy.common.utils.DateUtils;
@@ -19,13 +20,12 @@ import com.zkqy.business.service.IProductInvoiceService;
 
 /**
  * 产品发货单Service业务层处理
- * 
+ *
  * @author zkqy
  * @date 2024-04-11
  */
 @Service
-public class ProductInvoiceServiceImpl implements IProductInvoiceService 
-{
+public class ProductInvoiceServiceImpl implements IProductInvoiceService {
     @Autowired
     private ProductInvoiceMapper productInvoiceMapper;
 
@@ -46,37 +46,34 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService
 
     /**
      * 查询产品发货单
-     * 
+     *
      * @param id 产品发货单主键
      * @return 产品发货单
      */
     @Override
-    public ProductInvoice selectProductInvoiceById(Long id)
-    {
+    public ProductInvoice selectProductInvoiceById(Long id) {
         return productInvoiceMapper.selectProductInvoiceById(id);
     }
 
     /**
      * 查询产品发货单列表
-     * 
+     *
      * @param productInvoice 产品发货单
      * @return 产品发货单
      */
     @Override
-    public List<ProductInvoice> selectProductInvoiceList(ProductInvoice productInvoice)
-    {
+    public List<ProductInvoice> selectProductInvoiceList(ProductInvoice productInvoice) {
         return productInvoiceMapper.selectProductInvoiceList(productInvoice);
     }
 
     /**
      * 新增产品发货单
-     * 
+     *
      * @param productInvoice 产品发货单
      * @return 结果
      */
     @Override
-    public int insertProductInvoice(ProductInvoice productInvoice)
-    {
+    public int insertProductInvoice(ProductInvoice productInvoice) {
         productInvoice.setCreateTime(DateUtils.getNowDate());
         productInvoice.setCreateBy(SecurityUtils.getUsername());
         productInvoice.setCreateById(SecurityUtils.getUserId());
@@ -85,13 +82,12 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService
 
     /**
      * 修改产品发货单
-     * 
+     *
      * @param productInvoice 产品发货单
      * @return 结果
      */
     @Override
-    public int updateProductInvoice(ProductInvoice productInvoice)
-    {
+    public int updateProductInvoice(ProductInvoice productInvoice) {
         productInvoice.setUpdateTime(DateUtils.getNowDate());
         productInvoice.setUpdateById(SecurityUtils.getUserId());
         productInvoice.setUpdateBy(SecurityUtils.getUsername());
@@ -100,25 +96,23 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService
 
     /**
      * 批量删除产品发货单
-     * 
+     *
      * @param ids 需要删除的产品发货单主键
      * @return 结果
      */
     @Override
-    public int deleteProductInvoiceByIds(Long[] ids)
-    {
+    public int deleteProductInvoiceByIds(Long[] ids) {
         return productInvoiceMapper.deleteProductInvoiceByIds(ids);
     }
 
     /**
      * 删除产品发货单信息
-     * 
+     *
      * @param id 产品发货单主键
      * @return 结果
      */
     @Override
-    public int deleteProductInvoiceById(Long id)
-    {
+    public int deleteProductInvoiceById(Long id) {
         return productInvoiceMapper.deleteProductInvoiceById(id);
     }
 
@@ -128,66 +122,66 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService
         ProductInvoiceVO vo = new ProductInvoiceVO();
         // 顶部数据回显
         ProductInvoice productInvoice = productInvoiceMapper.selectProductInvoiceBySaleOrderNo(saleOrderNo);
-        if(productInvoice != null){
+        if (productInvoice != null) {
             BeanUtils.copyProperties(productInvoice, vo);
-        }else {
+        } else {
             SaleOrder saleOrder = saleOrderMapper.selectSaleOrderBySaleNo(saleOrderNo);
             vo.setCustomerNo(saleOrder.getSaleCustomNo());
         }
 
-            //表格数据
+        //表格数据
 
-            //查询所有订单货品信息
-            List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList = saleProductsMapper.selectSaleProductsInfo1(saleOrderNo);
-
-            if(productInvoice != null){
-                //根据通知单号查询货品信息
-                List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList1 = saleProductsMapper.selectSaleProductsInfo2(productInvoice.getNoticeNumber());
+        //查询所有订单货品信息
+        List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList = saleProductsMapper.selectSaleProductsInfo1(saleOrderNo);
 
-                List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList2 = new ArrayList<>();
-                saleProductInfoList2.addAll(saleProductInfoList);
+        if (productInvoice != null) {
+            //根据通知单号查询货品信息
+            List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList1 = saleProductsMapper.selectSaleProductsInfo2(productInvoice.getNoticeNumber());
 
-                for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList2){
-                    for (ProductInvoiceVO.SaleProductInfo saleProductInfo1 : saleProductInfoList1){
-                        if(saleProductInfo1.getProductId().equals(saleProductInfo.getProductId()) && saleProductInfo1.getProductColor().equals(saleProductInfo.getProductColor())){
-                            saleProductInfoList.remove(saleProductInfo);
-                        }
-                    }
-                }
-                if(saleProductInfoList.size() > 0){
-                    saleProductInfoList.forEach(saleProductInfo -> {
-                        saleProductInfo.setBoxNum(0);
-                        saleProductInfo.setWeight(0.0);
-                    });
-                    saleProductInfoList1.addAll(saleProductInfoList);
-                }
+            List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList2 = new ArrayList<>();
+            saleProductInfoList2.addAll(saleProductInfoList);
 
-                vo.setSaleProductInfoList(saleProductInfoList1);
-                if(saleProductInfoList1.size() > 0){
-                    ProductInventory productInventory1 = new ProductInventory();
-                    productInventory1.setProductId(saleProductInfoList1.get(0).getProductId());
-                    productInventory1.setLotNum(saleProductInfoList1.get(0).getLotNum());
-                    ProductInventory productInventory = productInventoryMapper.selectProductInventoryByLotNumAndProductId(productInventory1);
-                    if(productInventory != null){
-                        vo.setInventoryBoxNum(productInventory.getTotalBoxNum());
-                        vo.setInventoryWeight(handlingWeight(productInventory.getTotalSuttle()));
-                    }else {
-                        vo.setInventoryBoxNum(0);
-                        vo.setInventoryWeight(0.0);
+            for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList2) {
+                for (ProductInvoiceVO.SaleProductInfo saleProductInfo1 : saleProductInfoList1) {
+                    if (saleProductInfo1.getProductId().equals(saleProductInfo.getProductId()) && saleProductInfo1.getProductColor().equals(saleProductInfo.getProductColor())) {
+                        saleProductInfoList.remove(saleProductInfo);
                     }
                 }
-
-            }else {
-                for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList){
+            }
+            if (saleProductInfoList.size() > 0) {
+                saleProductInfoList.forEach(saleProductInfo -> {
                     saleProductInfo.setBoxNum(0);
                     saleProductInfo.setWeight(0.0);
+                });
+                saleProductInfoList1.addAll(saleProductInfoList);
+            }
+
+            vo.setSaleProductInfoList(saleProductInfoList1);
+            if (saleProductInfoList1.size() > 0) {
+                ProductInventory productInventory1 = new ProductInventory();
+                productInventory1.setProductId(saleProductInfoList1.get(0).getProductId());
+                productInventory1.setLotNum(saleProductInfoList1.get(0).getLotNum());
+                ProductInventory productInventory = productInventoryMapper.selectProductInventoryByLotNumAndProductId(productInventory1);
+                if (productInventory != null) {
+                    vo.setInventoryBoxNum(productInventory.getTotalBoxNum());
+                    vo.setInventoryWeight(handlingWeight(productInventory.getTotalSuttle()));
+                } else {
+                    vo.setInventoryBoxNum(0);
+                    vo.setInventoryWeight(0.0);
                 }
-                vo.setInventoryBoxNum(0);
-                vo.setInventoryWeight(0.0);
-                vo.setSaleProductInfoList(saleProductInfoList);
             }
-            //客户编号
-            vo.setCustomerId(saleOrderMapper.selectCustomerIdBySaleNo(saleOrderNo));
+
+        } else {
+            for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList) {
+                saleProductInfo.setBoxNum(0);
+                saleProductInfo.setWeight(0.0);
+            }
+            vo.setInventoryBoxNum(0);
+            vo.setInventoryWeight(0.0);
+            vo.setSaleProductInfoList(saleProductInfoList);
+        }
+        //客户编号
+        vo.setCustomerId(saleOrderMapper.selectCustomerIdBySaleNo(saleOrderNo));
 
         return vo;
     }
@@ -211,14 +205,14 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService
         List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList2 = new ArrayList<>();
         saleProductInfoList2.addAll(saleProductInfoList);
 
-        for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList2){
-            for (ProductInvoiceVO.SaleProductInfo saleProductInfo1 : saleProductInfoList1){
-                if(saleProductInfo1.getProductId().equals(saleProductInfo.getProductId()) && saleProductInfo1.getProductColor().equals(saleProductInfo.getProductColor())){
+        for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList2) {
+            for (ProductInvoiceVO.SaleProductInfo saleProductInfo1 : saleProductInfoList1) {
+                if (saleProductInfo1.getProductId().equals(saleProductInfo.getProductId()) && saleProductInfo1.getProductColor().equals(saleProductInfo.getProductColor())) {
                     saleProductInfoList.remove(saleProductInfo);
                 }
             }
         }
-        if(saleProductInfoList.size() > 0){
+        if (saleProductInfoList.size() > 0) {
             saleProductInfoList.forEach(saleProductInfo -> {
                 saleProductInfo.setBoxNum(0);
                 saleProductInfo.setWeight(0.0);
@@ -232,7 +226,7 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService
         vo.setSaleProductInfoList(saleProductInfoList1);
         return vo;
     }
-    
+
 
     @Override
     public ProductInvoice selectProductInvoiceBySaleOrderNo(String saleOrderNo) {
@@ -244,15 +238,25 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService
         ProductInvoiceVO vo = new ProductInvoiceVO();
         // 查询发货通知单详情
         ProductInvoice productInvoice = productInvoiceMapper.selectProductInvoiceById(id);
-        BeanUtils.copyProperties(productInvoice,vo);
+        BeanUtils.copyProperties(productInvoice, vo);
         //查询发货货品详情
         List<ProductCodeListVO> productCodeListVOS = productOutboundRecordMapper.selectOutboundProduct(productInvoice.getNoticeNumber());
         vo.setProductCodeListVOList(productCodeListVOS);
         return vo;
     }
 
+    @Override
+    public List<Map<String, Object>> financialStatementList(ProductInvoiceFinancialExportVo productInvoiceFinancialExportVo) {
+        return productInvoiceMapper.financialStatementList(productInvoiceFinancialExportVo);
+    }
+
+    @Override
+    public List<ProductInvoiceFinancialExportVo> financialStatementExportList(ProductInvoiceFinancialExportVo productInvoiceFinancialExportVo) {
+        return productInvoiceMapper.financialStatementExportList(productInvoiceFinancialExportVo);
+    }
+
     //保留两位小数
-    public Double handlingWeight(Double weight){
+    public Double handlingWeight(Double weight) {
         DecimalFormat df = new DecimalFormat("0.00");
         return Double.parseDouble(df.format(weight));
     }

+ 80 - 0
zkqy-custom-business/src/main/resources/mapper/business/ProductInvoiceMapper.xml

@@ -183,4 +183,84 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         update {DBNAME}.product_invoice set del_flag = '2' where sale_order_no = #{saleOrderNo}
     </update>
 
+    <select id="financialStatementList"  resultType="map">
+        select so.id,
+        so.sale_no,
+        so.sale_date,
+        c.custom_name,
+        so.sale_order_estimated_time,
+        so.sale_lead_time,
+        so.sale_amount_in_words,
+        so.sale_pay_type,
+        so.salesman,
+        so.sale_leader,
+        so.finance,
+        so.production,
+        so.sale_approver,
+        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
+        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>
+        <if test="noticeDate != null ">and so.notice_date = #{noticeDate}</if>
+        <if test="orderType == 'contractOrder'">
+            and so.sale_order_technology_no != 'retailOrder'
+        </if>
+        <if test="orderType == 'retailOrder'">
+            and so.sale_order_technology_no = 'retailOrder'
+        </if>
+        order by so.id desc
+    </select>
+    <select id="financialStatementExportList" resultType="com.zkqy.business.domain.vo.ProductInvoiceFinancialExportVo" parameterType="com.zkqy.business.domain.vo.ProductInvoiceFinancialExportVo">
+        select
+        pi2.notice_number ,
+        c.custom_name,
+        p.product_name ,
+        p.product_specifications ,
+        por.levels ,
+        por.lot_num ,
+        por.product_colour,
+        sum(por.suttle) as suttle
+        from
+        {DBNAME}.product_invoice pi2
+        inner join
+        {DBNAME}.product_outbound_record por on
+        pi2.notice_number = por.notice_number
+        left join {DBNAME}.customer c on
+        c.id = pi2.customer_id
+        left join {DBNAME}.sale_products sp on
+        sp.sale_order_no = pi2.sale_order_no
+        left join {DBNAME}.production p on
+        p.product_no = sp.product_no
+        and p.del_flag = 0
+        left join {DBNAME}.sale_order so on
+        so.sale_no = pi2.sale_order_no
+        and so.del_flag = 0 and so.status = 6
+        <if test="orderType == 'contractOrder'">
+            and so.sale_order_technology_no != 'retailOrder'
+        </if>
+        <if test="orderType == 'retailOrder'">
+            and so.sale_order_technology_no = 'retailOrder'
+        </if>
+        where pi2.del_flag = 0
+        and pi2.status = 2
+        <if test="noticeNumber != null  and noticeNumber != ''">and pi.notice_number = #{noticeNumber}</if>
+        <if test="customerId != null  and customerId != ''">and c.id = #{customerId}</if>
+        <if test="noticeDate != null ">and pi.notice_date = #{noticeDate}</if>
+        group by
+        por.lot_num ,
+        por.product_id ,
+        por.levels ,
+        por.product_colour
+        order by
+        pi2.create_time
+    </select>
+
 </mapper>

+ 9 - 0
zkqy-ui/src/api/system/ProductInvoice.js

@@ -9,6 +9,15 @@ export function listProductInvoice(query) {
   })
 }
 
+// 查询产品财务对账单列表
+export function financialStatementList(query) {
+  return request({
+    url: '/system/ProductInvoice/financialStatementList',
+    method: 'get',
+    params: query
+  })
+}
+
 // 查询产品发货单详细
 export function getProductInvoice(id) {
   return request({

+ 10 - 1
zkqy-ui/src/api/system/retailMange.js

@@ -106,4 +106,13 @@ export function getProductInventory(data) {
     method: 'post',
     data: data
   })
-}
+}
+// 零售订单完成回调
+export function updateOrder(data) {
+  return request({
+    url: '/system/order/updateOrder',
+    method: 'put',
+    data: data
+  })
+}
+

+ 55 - 22
zkqy-ui/src/views/orderMange/approve.vue

@@ -1085,7 +1085,6 @@ export default {
         },
       ];
       let res = await queryDropDownBoxData(payLoad);
-      await this.getDropDownData();
       if (res.code == 200) {
         console.log(res);
         let { sale_craft, sale_order, sale_products } = res.data.resultMap;
@@ -1146,7 +1145,7 @@ export default {
             <tbody>
                 <tr>
                     <td width="600px" colspan="4">合同号:${saleNo}</td>
-                    <td width="600px" colspan="4">日期:${saleDate.replace(
+                    <td width="600px" colspan="5">日期:${saleDate.replace(
                       "T",
                       " "
                     )}</td>
@@ -1155,11 +1154,11 @@ export default {
                     <td width="300px" colspan="2">客户名称:</td>
                     <td width="300px" colspan="2">${customerName}</td>
                     <td width="300px" colspan="2">联系人:</td>
-                    <td width="150px" colspan="1">${contactPerson}</td>
+                    <td width="150px" colspan="3">${contactPerson}</td>
                 </tr>
                 <tr align="center">
                     <td width="300px" colspan="2">客户地址:</td>
-                    <td width="300px" colspan="2">${customAddress}</td>
+                    <td width="300px" colspan="3">${customAddress}</td>
                     <td width="300px" colspan="2">客户国别:</td>
                     <td width="300px" colspan="2">${customCountryType}</td>
                 </tr>
@@ -1169,22 +1168,23 @@ export default {
                       "T",
                       " "
                     )}</td>
-                    <td  colspan="1">交货周期:</td>
+                    <td  colspan="2">交货周期:</td>
                     <td >${saleLeadTime}</td>
                     <td  colspan="2">交货日期:</td>
                     <td >${deliveryDate.replace("T", " ")}</td>
                 </tr>
                 <tr align="center">
-                    <td colspan="8">货品明细</td>
+                    <td colspan="9">货品明细</td>
                 </tr>
                 <tr align="center">
                     <td width="150px">品名</td>
-                    <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>
                     <td width="150px">备注</td>
                 </tr>`;
         let amountTotal = 0,
@@ -1198,27 +1198,31 @@ export default {
           let productData = this.allProductionOptions.find(
             (pro) => pro.productNo == item.productNo
           );
-          console.log(this.allProductionOptions);
-          console.log("productData", productData);
+          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>${productType}</td>    
+                    <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>${materieEncoding + item.colourNumberLabel}</td>
                     <td>${item.remark}</td>
                 </tr>`;
         }
@@ -1227,15 +1231,16 @@ export default {
         <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>
-          <td></td>
         </tr>
                 <tr>
-                    <td colspan="8">合计金额(大写):${saleAmountInWords}</td>
+                    <td colspan="9">合计金额(大写):${saleAmountInWords}</td>
                 </tr>
                 `;
 
@@ -1244,16 +1249,16 @@ export default {
           printStr += `
           <tr>
             <td colspan="4">付款方式:${payType}</td>
-            <td colspan="4">定金:${earnestMoney}</td>
+            <td colspan="5">定金:${earnestMoney}</td>
           </tr>`;
         } else {
           printStr += `
          <tr>
-              <td colspan="8">付款方式:${payType}</td>
+              <td colspan="9">付款方式:${payType}</td>
           </tr>`;
         }
         printStr += `<tr align="center">
-                    <td colspan="8">工艺要求</td>
+                    <td colspan="9">工艺要求</td>
                 </tr>
                 <tr align="center">
                     <td width="150px">网络</td>
@@ -1264,6 +1269,7 @@ export default {
                     <td width="150px">其他</td>
                     <td width="150px"></td>
                     <td width="150px"></td>
+                    <td width="150px"></td>
                 </tr>
                 <tr align="center">
                     <td >${craftGrid}</td>
@@ -1274,20 +1280,22 @@ export default {
                     <td>${craftOther}</td>
                     <td width="150px"></td>
                     <td width="150px"></td>
+                    <td width="150px"></td>
                 </tr>
                 <tr>
-                    <td colspan="8">包装/贴唛:${craftMark}</td>
+                    <td colspan="9">包装/贴唛:${craftMark}</td>
                 </tr>
                 <tr>
-                    <td colspan="8">装运方式:${shippingMethod}</td>
+                    <td colspan="9">装运方式:${shippingMethod}</td>
                 </tr>
                 <tr align="center">
                     <td colspan="2">业务员:</td>
                     <td colspan="2">${salesman}</td>
                     <td colspan="2">财务部:</td>
-                    <td colspan="2">${finance}</td>
-                    
+                    <td colspan="3">${finance}</td>
+
                 </tr>
+
                 <tr align="center">
                     <td colspan="2">业务主管:</td>
                     <td colspan="2">${saleApprover}</td>
@@ -1295,11 +1303,33 @@ export default {
                     <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>
       }
     },
     // 审批状态改变回调
@@ -2885,6 +2915,9 @@ export default {
       // console.log(value, label);
     },
   },
+  mounted() {
+    this.getDropDownData();
+  },
 };
 </script>
 

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

@@ -987,12 +987,13 @@ export default {
         suttle, //净重
         remark, //备注
         printFormat,
+        qrCodeId,
       } = printRow;
       let uuid = uuidv4();
       let temp =
         id +
         "@" +
-        uuid +
+        qrCodeId +
         "@" +
         canisterNum +
         "@" +
@@ -1149,12 +1150,12 @@ export default {
             // 先打印
             this.changeGrossWeight(this.printTableData[0]);
             // 后端打印
-            // await this.newPrintHandler();
+            await this.newPrintHandler();
             // 前端打印
-            codeListPrint(this.printTableData, "printDom");
-            if (this.excuteType == 1) {
-              this.tableData.push(this.printTableData[0]);
-            }
+            // codeListPrint(this.printTableData, "printDom");
+            // if (this.excuteType == 1) {
+            //   this.tableData.push(this.printTableData[0]);
+            // }
             // 后保存数据
             let payLoad = {
               ...this.form,

+ 39 - 19
zkqy-ui/src/views/orderMange/financeApprove.vue

@@ -615,7 +615,6 @@ export default {
         },
       ];
       let res = await queryDropDownBoxData(payLoad);
-      await this.getDropDownData();
       if (res.code == 200) {
         console.log(res);
         let { sale_craft, sale_order, sale_products } = res.data.resultMap;
@@ -676,7 +675,7 @@ export default {
             <tbody>
                 <tr>
                     <td width="600px" colspan="4">合同号:${saleNo}</td>
-                    <td width="600px" colspan="4">日期:${saleDate.replace(
+                    <td width="600px" colspan="5">日期:${saleDate.replace(
                       "T",
                       " "
                     )}</td>
@@ -685,11 +684,11 @@ export default {
                     <td width="300px" colspan="2">客户名称:</td>
                     <td width="300px" colspan="2">${customerName}</td>
                     <td width="300px" colspan="2">联系人:</td>
-                    <td width="150px" colspan="1">${contactPerson}</td>
+                    <td width="150px" colspan="3">${contactPerson}</td>
                 </tr>
                 <tr align="center">
                     <td width="300px" colspan="2">客户地址:</td>
-                    <td width="300px" colspan="2">${customAddress}</td>
+                    <td width="300px" colspan="3">${customAddress}</td>
                     <td width="300px" colspan="2">客户国别:</td>
                     <td width="300px" colspan="2">${customCountryType}</td>
                 </tr>
@@ -699,22 +698,23 @@ export default {
                       "T",
                       " "
                     )}</td>
-                    <td  colspan="1">交货周期:</td>
+                    <td  colspan="2">交货周期:</td>
                     <td >${saleLeadTime}</td>
                     <td  colspan="2">交货日期:</td>
                     <td >${deliveryDate.replace("T", " ")}</td>
                 </tr>
                 <tr align="center">
-                    <td colspan="8">货品明细</td>
+                    <td colspan="9">货品明细</td>
                 </tr>
                 <tr align="center">
                     <td width="150px">品名</td>
-                    <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>
                     <td width="150px">备注</td>
                 </tr>`;
         let amountTotal = 0,
@@ -728,26 +728,31 @@ export default {
           let productData = this.allProductionOptions.find(
             (pro) => pro.productNo == item.productNo
           );
-          console.log("item", item);
+          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>${materieEncoding + item.colourNumberLabel}</td>
                     <td>${item.remark}</td>
                 </tr>`;
         }
@@ -756,15 +761,16 @@ export default {
         <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>
-          <td></td>
         </tr>
                 <tr>
-                    <td colspan="8">合计金额(大写):${saleAmountInWords}</td>
+                    <td colspan="9">合计金额(大写):${saleAmountInWords}</td>
                 </tr>
                 `;
 
@@ -773,16 +779,16 @@ export default {
           printStr += `
           <tr>
             <td colspan="4">付款方式:${payType}</td>
-            <td colspan="4">定金:${earnestMoney}</td>
+            <td colspan="5">定金:${earnestMoney}</td>
           </tr>`;
         } else {
           printStr += `
          <tr>
-              <td colspan="8">付款方式:${payType}</td>
+              <td colspan="9">付款方式:${payType}</td>
           </tr>`;
         }
         printStr += `<tr align="center">
-                    <td colspan="8">工艺要求</td>
+                    <td colspan="9">工艺要求</td>
                 </tr>
                 <tr align="center">
                     <td width="150px">网络</td>
@@ -793,6 +799,7 @@ export default {
                     <td width="150px">其他</td>
                     <td width="150px"></td>
                     <td width="150px"></td>
+                    <td width="150px"></td>
                 </tr>
                 <tr align="center">
                     <td >${craftGrid}</td>
@@ -803,20 +810,22 @@ export default {
                     <td>${craftOther}</td>
                     <td width="150px"></td>
                     <td width="150px"></td>
+                    <td width="150px"></td>
                 </tr>
                 <tr>
-                    <td colspan="8">包装/贴唛:${craftMark}</td>
+                    <td colspan="9">包装/贴唛:${craftMark}</td>
                 </tr>
                 <tr>
-                    <td colspan="8">装运方式:${shippingMethod}</td>
+                    <td colspan="9">装运方式:${shippingMethod}</td>
                 </tr>
                 <tr align="center">
                     <td colspan="2">业务员:</td>
                     <td colspan="2">${salesman}</td>
                     <td colspan="2">财务部:</td>
-                    <td colspan="2">${finance}</td>
+                    <td colspan="3">${finance}</td>
+
                 </tr>
-                
+
                 <tr align="center">
                     <td colspan="2">业务主管:</td>
                     <td colspan="2">${saleApprover}</td>
@@ -824,11 +833,19 @@ export default {
                     <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>
@@ -2372,6 +2389,9 @@ export default {
       // console.log(value, label);
     },
   },
+  mounted() {
+    this.getDropDownData();
+  },
 };
 </script>
 

+ 46 - 30
zkqy-ui/src/views/orderMange/financialReconciliation/index.vue

@@ -6,8 +6,26 @@
       size="small"
       :inline="true"
       v-show="showSearch"
-      label-width="68px"
+      label-width="80px"
     >
+      <el-form-item label="订单类型" prop="customerId">
+        <el-select
+          v-model="queryParams.orderType"
+          placeholder="订单类型"
+          @keyup.enter.native.prevent
+          @change="handleQuery">
+          <el-option
+            key="contractOrder"
+            label="合同单"
+            value="false">
+          </el-option>
+          <el-option
+            key="retailOrder"
+            label="零售单"
+            value="true">
+          </el-option>
+        </el-select>
+      </el-form-item>
       <el-form-item label="通知单号" prop="noticeNumber">
         <el-input
           v-model="queryParams.noticeNumber"
@@ -46,12 +64,6 @@
       </el-form-item> -->
 
       <el-form-item label="客户" prop="customerId">
-        <!-- <el-input
-          v-model="queryParams.customerId"
-          placeholder="请输入客户编号"
-          clearable
-          @keyup.enter.native="handleQuery"
-        /> -->
         <el-select
           v-model="queryParams.customerId"
           placeholder="请选择客户"
@@ -68,16 +80,19 @@
           </el-option>
         </el-select>
       </el-form-item>
+
       <el-form-item>
         <el-button
           type="primary"
           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>
@@ -118,6 +133,7 @@
           >删除</el-button
         >
       </el-col>
+      -->
       <el-col :span="1.5">
         <el-button
           type="warning"
@@ -126,9 +142,10 @@
           size="mini"
           @click="handleExport"
           v-hasPermi="['system:ProductInvoice:export']"
-          >导出</el-button
+        >导出
+        </el-button
         >
-      </el-col> -->
+      </el-col>
       <right-toolbar
         :showSearch.sync="showSearch"
         @queryTable="getList"
@@ -152,7 +169,7 @@
           <span>{{ parseTime(scope.row.noticeDate, "{y}-{m}-{d}") }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="通知单号" align="center" prop="noticeNumber" />
+      <el-table-column label="通知单号" align="center" prop="noticeNumber"/>
 
       <!-- <el-table-column label="销售员" align="center" prop="salesman" />
       <el-table-column label="客户编号" align="center" prop="customerId" />
@@ -172,7 +189,7 @@
       <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="customerName"/>
       <!-- <el-table-column label="状态" align="center" prop="status">
         <template slot-scope="scope">{{ scope.row.status }}</template>
       </el-table-column> -->
@@ -199,12 +216,9 @@
                 >
               </el-dropdown-item> -->
               <el-dropdown-item>
-                <el-button
-                  type="text"
-                  size="mini"
-                  @click="handleSendOrder(scope.$index, scope.row)"
-                  >打印对账单</el-button
-                >
+                <el-button type="text" size="mini" @click="handleSendOrder(scope.$index, scope.row)">
+                  打印对账单
+                </el-button>
               </el-dropdown-item>
             </el-dropdown-menu>
           </el-dropdown>
@@ -225,7 +239,7 @@
 
 <script>
 import {
-  listProductInvoice,
+  financialStatementList,
   getProductInvoice,
   delProductInvoice,
   addProductInvoice,
@@ -238,7 +252,7 @@ import {
   queryDropDownBoxData,
   printDocuments,
 } from "@/api/tablelist/commonTable";
-import { mapState } from "vuex";
+import {mapState} from "vuex";
 
 export default {
   name: "ProductInvoice",
@@ -280,6 +294,7 @@ export default {
         calculationType: null,
         auditOpinion: null,
         status: 2,
+        orderType: "contractOrder"  // 零售单/合同单
       },
       // 表单参数
       form: {},
@@ -318,7 +333,7 @@ export default {
     },
     // 打印发货单回调
     async handleDeliverOrder(index, row) {
-      let { saleOrderNo } = row;
+      let {saleOrderNo} = row;
       if (!saleOrderNo) {
         this.$message.error("数据异常,暂无saleOrderNo");
       }
@@ -335,7 +350,7 @@ export default {
           printUser: this.username,
         });
         deliverOrderPrint(
-          { ...row, ...printData, printUser: this.username },
+          {...row, ...printData, printUser: this.username},
           "printDom"
         );
       } else {
@@ -346,7 +361,7 @@ export default {
     },
     // 打印送货单回调
     async handleSendOrder(index, row) {
-      let { saleOrderNo } = row;
+      let {saleOrderNo} = row;
       if (!saleOrderNo) {
         this.$message.error("数据异常,暂无saleOrderNo");
       }
@@ -354,7 +369,7 @@ export default {
         saleOrderNo: saleOrderNo,
       };
       // let res = await productInvoiceInfo(payload);
-      let res = await printDocuments({ id: row.id });
+      let res = await printDocuments({id: row.id});
       if (res.code == 200) {
         let printData = res.data;
         console.log("printData", {
@@ -363,7 +378,7 @@ export default {
           printUser: this.username,
         });
         sendOrderPrint(
-          { ...row, ...printData, printUser: this.username },
+          {...row, ...printData, printUser: this.username},
           "printDom"
         );
       } else {
@@ -374,7 +389,7 @@ export default {
     /** 查询产品发货单列表 */
     getList() {
       this.loading = true;
-      listProductInvoice(this.queryParams).then((response) => {
+      financialStatementList(this.queryParams).then((response) => {
         this.ProductInvoiceList = response.rows;
         this.total = response.total;
         this.loading = false;
@@ -482,16 +497,17 @@ export default {
           this.getList();
           this.$modal.msgSuccess("删除成功");
         })
-        .catch(() => {});
+        .catch(() => {
+        });
     },
     /** 导出按钮操作 */
     handleExport() {
       this.download(
-        "system/ProductInvoice/export",
+        "/system/ProductInvoice/importFinancialStatement",
         {
           ...this.queryParams,
         },
-        `ProductInvoice_${new Date().getTime()}.xlsx`
+        `客户销售汇总_${new Date().getTime()}.xlsx`
       );
     },
   },

+ 122 - 58
zkqy-ui/src/views/orderMange/index.vue

@@ -431,7 +431,11 @@
                   </el-form-item>
                 </template>
               </el-table-column>
-              <el-table-column prop="productSpecifications" label="规格">
+              <el-table-column
+                prop="productSpecifications"
+                width="180"
+                label="规格"
+              >
                 <template slot-scope="scope">
                   <el-select
                     v-model="scope.row.productSpecifications"
@@ -458,6 +462,38 @@
               </el-table-column>
               <el-table-column prop="productType" label="类型">
               </el-table-column>
+              <el-table-column prop="colourNumber" label="色号">
+                <template slot-scope="scope">
+                  <el-form-item
+                    :prop="'colourNumber-' + scope.$index"
+                    :name="'colourNumber-' + scope.$index"
+                    style="margin: 0px; padding: 0px"
+                  >
+                    <el-select
+                      v-model="scope.row.colourNumber"
+                      placeholder=""
+                      clearable
+                      filterable
+                      @change="colourNumberChangeHandler(scope.row)"
+                    >
+                      <el-option
+                        v-for="item in colourNumberOptions"
+                        :key="item.materielCode"
+                        :label="item.materieEncoding + item.materieColorNumber"
+                        :value="item.materielCode"
+                      >
+                        <span class="discribe" style="float: left">{{
+                          item.materieEncoding + item.materieColorNumber
+                        }}</span>
+                        <!-- <span
+                        style="float: right; color: #8492a6; font-size: 13px"
+                        >{{ item.materielCode }}</span
+                      > -->
+                      </el-option>
+                    </el-select>
+                  </el-form-item>
+                </template>
+              </el-table-column>
               <el-table-column prop="productNumber" label="数量/kg">
                 <template slot-scope="scope">
                   <el-form-item
@@ -522,38 +558,7 @@
                   </el-form-item>
                 </template>
               </el-table-column>
-              <el-table-column prop="colourNumber" label="色号">
-                <template slot-scope="scope">
-                  <el-form-item
-                    :prop="'colourNumber-' + scope.$index"
-                    :name="'colourNumber-' + scope.$index"
-                    style="margin: 0px; padding: 0px"
-                  >
-                    <el-select
-                      v-model="scope.row.colourNumber"
-                      placeholder=""
-                      clearable
-                      filterable
-                      @change="colourNumberChangeHandler(scope.row)"
-                    >
-                      <el-option
-                        v-for="item in colourNumberOptions"
-                        :key="item.materielCode"
-                        :label="item.materieEncoding + item.materieColorNumber"
-                        :value="item.materielCode"
-                      >
-                        <span class="discribe" style="float: left">{{
-                          item.materieEncoding + item.materieColorNumber
-                        }}</span>
-                        <!-- <span
-                        style="float: right; color: #8492a6; font-size: 13px"
-                        >{{ item.materielCode }}</span
-                      > -->
-                      </el-option>
-                    </el-select>
-                  </el-form-item>
-                </template>
-              </el-table-column>
+
               <el-table-column prop="remark" label="备注">
                 <template slot-scope="scope">
                   <el-input
@@ -825,6 +830,7 @@ import {
   getSaleOrderProductionListDistinct,
   getProductSpecificationsByProductName,
 } from "@/api/tablelist/commonTable";
+import { updateOrder } from "@/api/system/retailMange.js";
 import { listData } from "@/api/system/tenant/data";
 import { getToken } from "@/utils/auth";
 import Queryfrom from "@/views/tablelist/commonTable/queryfrom.vue";
@@ -1336,7 +1342,7 @@ export default {
         if (
           index === 1 ||
           index === 2 ||
-          index === 6 ||
+          index === 3 ||
           index === 7 ||
           index === 8 ||
           index === 9
@@ -1385,6 +1391,7 @@ export default {
         colourNumber: "", //色号
         remark: "", //备注
         specificationsList: [],
+        productSpecifications: "", //型号
       });
       // 添加校验规则
       this.initTableValidate();
@@ -1466,7 +1473,7 @@ export default {
     //审计新增
     async addHandler() {
       this.isEdit = false;
-      await this.getDropDownData();
+      // await this.getDropDownData();
       this.resetFormData();
 
       this.title = "新增销售单";
@@ -1515,6 +1522,12 @@ export default {
         } else {
           throw Error("获取下拉框数据失败");
         }
+        let allProRes = await getSaleOrderProductionList();
+        if (allProRes.code == 200) {
+          this.allProductionOptions = allProRes.data || [];
+        } else {
+          console.log(allProRes);
+        }
       } catch (error) {
         console.log(error);
       }
@@ -1650,6 +1663,15 @@ export default {
                 '[{"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"}]',
               children: [],
               btnHasPermi: "huaxian:xsglddgl:INSERT",
+            },
+            {
+              btnName: "完成",
+              btnType: "myComplate",
+              btnIcon: "",
+              btnShowCondition:
+                '[{"fieldName":"sale_order.status","mark":"6","refValue":"9"}]',
+              children: [],
+              btnHasPermi: "huaxian:xsglddgl:INSERT",
             }
           );
           // }
@@ -1927,6 +1949,8 @@ export default {
             delete item.taskNodeKey;
             delete item.productionLineNo;
             delete item.status;
+            delete item.specificationsList;
+            delete item.productSpecifications;
             const matchedOption = this.colourNumberOptions.find(
               (option) => option.materielCode === item.colourNumber
             );
@@ -2078,19 +2102,25 @@ export default {
 
           this.productIds = sale_products.map((item) => item.saleProductNo);
 
-          await this.getDropDownData();
-          this.productionTableData = sale_products.map((item) => {
+          // await this.getDropDownData();
+          let promiseArr = [];
+          this.productionTableData = sale_products.map((item, index) => {
             let targetItem = this.allProductionOptions.find(
               (i) => item.productNo == i.productNo
             );
-            if (
-              !this.productionOptions.some((i) => i.productNo == item.productNo)
-            ) {
-              this.productionOptions.unshift(targetItem);
-            }
+            item.productSpecifications = targetItem?.productSpecifications;
             item.productType = targetItem?.productType;
+            promiseArr[index] = getProductSpecificationsByProductName({
+              productName: item.productName,
+            });
             return item;
           });
+
+          let promiseRes = await Promise.all(promiseArr);
+          promiseRes.forEach((item, index) => {
+            this.productionTableData[index].specificationsList = item.data;
+          });
+
           if (this.formData.saleCustomNo) {
             this.customChangeHandler(this.formData.saleCustomNo);
           }
@@ -3143,7 +3173,7 @@ export default {
             <tbody>
                 <tr>
                     <td width="600px" colspan="4">合同号:${saleNo}</td>
-                    <td width="600px" colspan="4">日期:${saleDate.replace(
+                    <td width="600px" colspan="5">日期:${saleDate.replace(
                       "T",
                       " "
                     )}</td>
@@ -3152,11 +3182,11 @@ export default {
                     <td width="300px" colspan="2">客户名称:</td>
                     <td width="300px" colspan="2">${customerName}</td>
                     <td width="300px" colspan="2">联系人:</td>
-                    <td width="150px" colspan="1">${contactPerson}</td>
+                    <td width="150px" colspan="3">${contactPerson}</td>
                 </tr>
                 <tr align="center">
                     <td width="300px" colspan="2">客户地址:</td>
-                    <td width="300px" colspan="2">${customAddress}</td>
+                    <td width="300px" colspan="3">${customAddress}</td>
                     <td width="300px" colspan="2">客户国别:</td>
                     <td width="300px" colspan="2">${customCountryType}</td>
                 </tr>
@@ -3166,22 +3196,23 @@ export default {
                       "T",
                       " "
                     )}</td>
-                    <td  colspan="1">交货周期:</td>
+                    <td  colspan="2">交货周期:</td>
                     <td >${saleLeadTime}</td>
                     <td  colspan="2">交货日期:</td>
                     <td >${deliveryDate.replace("T", " ")}</td>
                 </tr>
                 <tr align="center">
-                    <td colspan="8">货品明细</td>
+                    <td colspan="9">货品明细</td>
                 </tr>
                 <tr align="center">
                     <td width="150px">品名</td>
-                    <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>
                     <td width="150px">备注</td>
                 </tr>`;
         let amountTotal = 0,
@@ -3208,14 +3239,18 @@ export default {
           )?.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>${materieEncoding + item.colourNumberLabel}</td>
                     <td>${item.remark}</td>
                 </tr>`;
         }
@@ -3224,15 +3259,16 @@ export default {
         <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>
-          <td></td>
         </tr>
                 <tr>
-                    <td colspan="8">合计金额(大写):${saleAmountInWords}</td>
+                    <td colspan="9">合计金额(大写):${saleAmountInWords}</td>
                 </tr>
                 `;
 
@@ -3241,16 +3277,16 @@ export default {
           printStr += `
           <tr>
             <td colspan="4">付款方式:${payType}</td>
-            <td colspan="4">定金:${earnestMoney}</td>
+            <td colspan="5">定金:${earnestMoney}</td>
           </tr>`;
         } else {
           printStr += `
          <tr>
-              <td colspan="8">付款方式:${payType}</td>
+              <td colspan="9">付款方式:${payType}</td>
           </tr>`;
         }
         printStr += `<tr align="center">
-                    <td colspan="8">工艺要求</td>
+                    <td colspan="9">工艺要求</td>
                 </tr>
                 <tr align="center">
                     <td width="150px">网络</td>
@@ -3261,6 +3297,7 @@ export default {
                     <td width="150px">其他</td>
                     <td width="150px"></td>
                     <td width="150px"></td>
+                    <td width="150px"></td>
                 </tr>
                 <tr align="center">
                     <td >${craftGrid}</td>
@@ -3271,18 +3308,19 @@ export default {
                     <td>${craftOther}</td>
                     <td width="150px"></td>
                     <td width="150px"></td>
+                    <td width="150px"></td>
                 </tr>
                 <tr>
-                    <td colspan="8">包装/贴唛:${craftMark}</td>
+                    <td colspan="9">包装/贴唛:${craftMark}</td>
                 </tr>
                 <tr>
-                    <td colspan="8">装运方式:${shippingMethod}</td>
+                    <td colspan="9">装运方式:${shippingMethod}</td>
                 </tr>
                 <tr align="center">
                     <td colspan="2">业务员:</td>
                     <td colspan="2">${salesman}</td>
                     <td colspan="2">财务部:</td>
-                    <td colspan="2">${finance}</td>
+                    <td colspan="3">${finance}</td>
 
                 </tr>
 
@@ -3293,6 +3331,7 @@ export default {
                     <td></td>
                     <td></td>
                     <td></td>
+                    <td></td>
                 </tr>
             </tbody>
         </table>
@@ -3413,6 +3452,9 @@ export default {
         case "myDelete":
           this.myDeleteHandler(row, btnData);
           break;
+        case "myComplate":
+          this.myComplateHandler(row, btnData);
+          break;
         case "printOutBound":
           this.myPrintOutBoundHandler(row, btnData);
           break;
@@ -3423,6 +3465,28 @@ export default {
           break;
       }
     },
+    // 完成回调
+    async myComplateHandler(row) {
+      console.log(row);
+      let payload = {
+        id: row.id,
+        status: 6,
+      };
+      let res = await updateOrder(payload);
+      if (res.code == 200) {
+        this.$message({
+          type: "success",
+          message: "订单已完成",
+        });
+        this.getList();
+      } else {
+        this.$message({
+          type: "error",
+          message: "订单已完成失败,请稍后再试",
+        });
+        console.log(res);
+      }
+    },
     noNeedHandler(btnData, row) {
       this.$modal
         .confirm("是否确认执行该操作?")

+ 65 - 21
zkqy-ui/src/views/orderMange/outStock/index.vue

@@ -8,13 +8,14 @@
           @click="handleRefresh"
           :icon="loading ? 'el-icon-loading' : 'el-icon-refresh'"
           :disabled="loading"
-          >刷新</el-button
-        >
+          >刷新
+        </el-button>
 
         <el-table
           :data="leftTableData"
           border
           stripe
+          @selection-change="handleSelectionChange"
           @cell-click="cellClick"
           highlight-current-row
         >
@@ -104,7 +105,7 @@
                 </el-select>
               </el-form-item>
             </el-col>
-            <el-col :span="12">
+            <!-- <el-col :span="12">
               <el-form-item label="调拨仓库" prop="transferWarehouse">
                 <el-select
                   v-model="form.transferWarehouse"
@@ -120,16 +121,19 @@
                   </el-option>
                 </el-select>
               </el-form-item>
-            </el-col>
+            </el-col> -->
             <el-form-item>
               <el-button type="primary" @click="outStockHandler"
-                >出库</el-button
-              >
+                >出库
+              </el-button>
               <el-button @click="refreshHandler">刷新</el-button>
             </el-form-item>
           </el-form>
         </el-row>
-        <el-table width="100%" :data="saleProductInfoList" border stripe>
+        <!--        :span-method="objectSpanMethod"-->
+        <!--        :header-cell-style="{'text-align':'center'}"-->
+        <!--        :cell-style="{'text-align':'center'}" ref="tableRef"-->
+        <el-table :data="saleProductInfoList" border stripe>
           <el-table-column align="center" label="编码" prop="productCode">
           </el-table-column>
           <el-table-column align="center" label="品名" prop="productName">
@@ -170,6 +174,7 @@ import {
   noticeOutStorage,
 } from "@/api/tablelist/commonTable";
 import { mapState } from "vuex";
+
 export default {
   name: "OutStock",
   props: [],
@@ -177,6 +182,7 @@ export default {
   components: {},
   data() {
     return {
+      spanArr: [], // 用于记录每个 productCode 的跨行信息
       loading: false,
       currentIndex: "",
       form: {
@@ -212,6 +218,43 @@ export default {
     };
   },
   methods: {
+    // objectSpanMethod({row, column, rowIndex, columnIndex}) {
+    //   if (this.saleProductInfoList.length == 1 || this.saleProductInfoList.length == 0) {
+    //     console.log("当前长度不满足:" + this.saleProductInfoList.length);
+    //     return [1, 1];
+    //   }
+    //   console.log("当前长度满足le:" + this.saleProductInfoList.length);
+    //   if (columnIndex == 6) {
+    //     if (!this.spanArr[rowIndex]) {
+    //       this.spanArr[rowIndex] = {
+    //         rowspan: 1,
+    //         end: false,
+    //       };
+    //     }
+    //     console.log(this.saleProductInfoList);
+    //     console.log(rowIndex);
+    //     let duixiang = this.saleProductInfoList[rowIndex];
+    //     console.log(duixiang)
+    //     console.log(row.productCode === duixiang.productCode)
+    //     console.log(row.productCode, "----", duixiang.productCode)
+    //     if (rowIndex < this.saleProductInfoList.length - 1 && row.productCode === duixiang.productCode) {
+    //       if (!this.spanArr[rowIndex].end) {
+    //         this.spanArr[rowIndex].rowspan += 1;
+    //         this.spanArr[rowIndex + 1] = {
+    //           rowspan: 0,
+    //           end: false,
+    //         };
+    //       }
+    //     } else {
+    //       this.spanArr[rowIndex].end = true;
+    //     }
+    //     if (this.spanArr[rowIndex].rowspan >= 1) {
+    //       console.log([this.spanArr[rowIndex].rowspan, 1])
+    //       return [this.spanArr[rowIndex].rowspan, 1];
+    //     }
+    //   }
+    //
+    // },
     // 刷新回调
     async handleRefresh() {
       this.loading = true;
@@ -241,7 +284,7 @@ export default {
           })
             .then(async () => {
               let payLoad = { ...this.form };
-              console.log(this.form);
+              payLoad.transferWarehouse = payLoad.deliveryWarehouse;
               if (!this.form.id) {
                 return;
               }
@@ -287,9 +330,7 @@ export default {
         } else {
           throw new Error(res.msg);
         }
-      } catch (error) {
-        console.log(error);
-      }
+      } catch (error) {}
     },
     // 初始化数据
     async initData() {
@@ -308,9 +349,7 @@ export default {
         } else {
           throw new Error(res.msg);
         }
-      } catch (error) {
-        console.log(error);
-      }
+      } catch (error) {}
     },
     // 根据字典获取文件类型
     getdocumentTypeName(value) {
@@ -329,8 +368,6 @@ export default {
         id = this.leftTableData[this.currentIndex].id;
         customerName = this.leftTableData[this.currentIndex].customerName;
       }
-      console.log(this.leftTableData[this.currentIndex]);
-      console.log(id);
       if (!id) {
         //重置表单数据
         Object.assign(this.form, {
@@ -345,12 +382,10 @@ export default {
           deliveryClerk: "", //发货员
           id: "",
         });
-        console.log(this.form);
         return;
       }
       try {
         let res = await saleStorageDetails(id);
-        console.log(res);
         if (res.code == 200) {
           let {
             noticeNumber, //通知单号
@@ -365,6 +400,10 @@ export default {
           } = res.data;
           let documentTypeName = this.getdocumentTypeName(documentType);
           this.saleProductInfoList = saleProductInfoList;
+
+          // this.$nextTick(() => {
+          //   this.$refs.tableRef.doLayout();
+          // });
           Object.assign(this.form, {
             noticeNumber, //通知单号
             documentType, //通知单类型
@@ -378,9 +417,7 @@ export default {
           });
           this.form.deliveryClerk = this.nickName;
         }
-      } catch (error) {
-        console.log(error);
-      }
+      } catch (error) {}
     },
   },
   computed: {
@@ -398,14 +435,21 @@ export default {
 <style scoped lang="scss">
 .app-container {
   display: flex;
+
   .table-area {
     width: 600px;
   }
+
   .form-area {
     flex: 1;
   }
 }
+
 ::v-deep .el-table__body tr.current-row > td.el-table__cell {
   background-color: #55e905 !important;
 }
+
+.table-data > .gutter {
+  display: table-cell !important;
+}
 </style>

+ 427 - 117
zkqy-ui/src/views/orderMange/retailMange/index.vue

@@ -124,8 +124,9 @@
           style="float: right; margin-right: 100px"
           v-model="queryParams.status"
           @change="orderStartChange"
-          size="mini">
-<!--        未提交/和待出库  -->
+          size="mini"
+        >
+          <!--        未提交/和待出库  -->
           <el-radio-button :label="100">未完成</el-radio-button>
           <el-radio-button :label="200">已完成</el-radio-button>
         </el-radio-group>
@@ -170,7 +171,7 @@
                 操作<i class="el-icon-arrow-down el-icon--right"></i>
               </el-button>
               <el-dropdown-menu slot="dropdown">
-                <el-dropdown-item v-show="scope.row.status == 1">
+                <el-dropdown-item>
                   <el-button
                     size="mini"
                     type="text"
@@ -180,6 +181,16 @@
                     >修改
                   </el-button>
                 </el-dropdown-item>
+                <el-dropdown-item v-show="scope.row.status == 9">
+                  <el-button
+                    size="mini"
+                    type="text"
+                    icon="el-icon-edit"
+                    v-hasPermi="['system:RetailOrder:update']"
+                    @click="handleComplate(scope.row)"
+                    >完成
+                  </el-button>
+                </el-dropdown-item>
                 <el-dropdown-item>
                   <el-button
                     size="mini"
@@ -190,7 +201,7 @@
                     >详情
                   </el-button>
                 </el-dropdown-item>
-                <el-dropdown-item>
+                <!-- <el-dropdown-item>
                   <el-button
                     size="mini"
                     type="text"
@@ -199,7 +210,7 @@
                     @click="handleSubmit(scope.row)"
                     >提交
                   </el-button>
-                </el-dropdown-item>
+                </el-dropdown-item> -->
                 <el-dropdown-item v-show="scope.row.status == 5">
                   <el-button
                     size="mini"
@@ -362,6 +373,16 @@
                 {{ formData.saleAmountInWords }}
               </el-form-item>
             </el-col>
+            <el-col :span="12">
+              <el-form-item label-width="120px" label="货车登记:">
+                <el-input
+                  v-model="form.truckRegistration"
+                  size="small"
+                  clearable
+                ></el-input>
+                <!-- {{ formData.saleAmountInWords }} -->
+              </el-form-item>
+            </el-col>
             <!-- <el-col :span="12">
               <el-form-item label="付款方式:">
                 <el-select
@@ -405,6 +426,7 @@
               <el-divider>货品明细</el-divider>
             </el-col>
             <el-table
+              ref="productionTableRef"
               :data="productionTableData"
               border
               show-summary
@@ -420,81 +442,115 @@
                 clearable
               ></el-input> -->
                   <el-form-item
-                    :prop="'productNo-' + scope.$index"
-                    :name="'productNo-' + scope.$index"
+                    :prop="'productName-' + scope.$index"
+                    :name="'productName-' + scope.$index"
                     style="margin: 0px; padding: 0px"
                   >
+                    <!-- 
+                    @change="
+                        handleProductChange(scope.row.productNo, scope.row)
+                      "
+                      @blur="handleProductBlur(productNo)"
+                   -->
                     <el-select
-                      v-model="scope.row.productNo"
+                      v-model="scope.row.productName"
                       placeholder=""
-                      :filter-method="(val) => mySelectFilter(val, scope.row)"
-                      clearable
                       filterable
                       @change="
-                        handleProductChange(scope.row.productNo, scope.row)
+                        newProductChange(scope.row.productName, scope.row)
                       "
-                      @blur="handleProductBlur(productNo)"
                     >
                       <el-option
                         v-for="item in productionOptions"
-                        :key="item.productNo"
+                        :key="item.productName"
                         :label="item.productName"
-                        :value="item.productNo"
+                        :value="item.productName"
                       >
-                        <span class="discribe" style="float: left">{{
+                        <!-- <span class="discribe" style="float: left">{{
                           item.productName
                         }}</span>
                         <span
                           style="float: right; color: #8492a6; font-size: 13px"
                           >{{ item.productSpecifications }}</span
-                        >
+                        > -->
                       </el-option>
                     </el-select>
                   </el-form-item>
                 </template>
               </el-table-column>
-              <el-table-column prop="productType" label="类型">
-              </el-table-column>
-              <el-table-column prop="productNumber" label="箱数">
+              <el-table-column prop="productSpecifications" label="规格">
                 <template slot-scope="scope">
-                  <el-form-item
-                    :prop="'productNumber-' + scope.$index"
-                    :name="'productNumber-' + scope.$index"
-                    style="margin: 0px; padding: 0px"
+                  <el-select
+                    v-model="scope.row.productSpecifications"
+                    @change="handleSpecificationsChange(scope.row)"
+                    placeholder=""
+                    filterable
                   >
-                    <el-input
-                      v-model="scope.row.productNumber"
-                      oninput="value=value.replace(/[^0-9.]/g,'')"
-                      size="small"
-                      clearable
-                      @change="computedPrice(scope.row)"
-                    ></el-input>
-                  </el-form-item>
+                    <el-option
+                      v-for="item in scope.row.specificationsList"
+                      :key="item.productSpecifications"
+                      :label="item.productSpecifications"
+                      :value="item.productSpecifications"
+                    >
+                      <span class="discribe" style="float: left">{{
+                        item.productSpecifications
+                      }}</span>
+                      <span
+                        style="float: right; color: #8492a6; font-size: 13px"
+                        >{{ item.productType }}</span
+                      >
+                    </el-option>
+                  </el-select>
                 </template>
               </el-table-column>
-              <el-table-column prop="productUnitPrice" label="单价">
+              <el-table-column prop="colourNumber" label="色号">
                 <template slot-scope="scope">
                   <el-form-item
-                    :prop="'productUnitPrice-' + scope.$index"
-                    :name="'productUnitPrice-' + scope.$index"
+                    :prop="'colourNumber-' + scope.$index"
+                    :name="'colourNumber-' + scope.$index"
                     style="margin: 0px; padding: 0px"
                   >
-                    <el-input
-                      v-model="scope.row.productUnitPrice"
-                      size="small"
-                      oninput="value=value.replace(/[^0-9.]/g,'')"
-                      @change="computedPrice(scope.row)"
+                    <el-select
+                      v-model="scope.row.colourNumber"
+                      placeholder=""
                       clearable
-                    ></el-input>
+                      filterable
+                      @change="colourNumberChangeHandler(scope.row)"
+                    >
+                      <el-option
+                        v-for="item in colourNumberOptions"
+                        :key="item.materielCode"
+                        :label="item.materieEncoding + item.materieColorNumber"
+                        :value="item.materielCode"
+                      >
+                        <span class="discribe" style="float: left">{{
+                          item.materieEncoding + item.materieColorNumber
+                        }}</span>
+                        <!-- <span
+                        style="float: right; color: #8492a6; font-size: 13px"
+                        >{{ item.materielCode }}</span
+                      > -->
+                      </el-option>
+                    </el-select>
                   </el-form-item>
                 </template>
               </el-table-column>
-              <el-table-column prop="productAmounts" label="金额">
+              <el-table-column prop="productType" label="类型">
+              </el-table-column>
+
+              <el-table-column prop="lotNumber" label="批号">
                 <template slot-scope="scope">
-                  {{ scope.row.productAmounts }}
+                  <el-input
+                    v-model="scope.row.lotNumber"
+                    placeholder=""
+                    size="small"
+                    clearable
+                    @blur="updateStorage(scope.row)"
+                  ></el-input>
                 </template>
               </el-table-column>
-              <el-table-column prop="sliceType" label="切片型号">
+
+              <!-- <el-table-column prop="sliceType" label="切片型号">
                 <template slot-scope="scope">
                   <el-form-item
                     :prop="'sliceType-' + scope.$index"
@@ -518,39 +574,57 @@
                     </el-select>
                   </el-form-item>
                 </template>
+              </el-table-column> -->
+
+              <el-table-column prop="productNumber" label="箱数">
+                <template slot-scope="scope">
+                  <el-form-item
+                    :prop="'productNumber-' + scope.$index"
+                    :name="'productNumber-' + scope.$index"
+                    style="margin: 0px; padding: 0px"
+                  >
+                    <el-input
+                      v-model="scope.row.productNumber"
+                      oninput="value=value.replace(/[^0-9.]/g,'')"
+                      size="small"
+                      clearable
+                      @change="computedPrice(scope.row)"
+                    ></el-input>
+                  </el-form-item>
+                </template>
               </el-table-column>
-              <el-table-column prop="colourNumber" label="色号">
+              <el-table-column prop="productUnitPrice" label="单价">
                 <template slot-scope="scope">
                   <el-form-item
-                    :prop="'colourNumber-' + scope.$index"
-                    :name="'colourNumber-' + scope.$index"
+                    :prop="'productUnitPrice-' + scope.$index"
+                    :name="'productUnitPrice-' + scope.$index"
                     style="margin: 0px; padding: 0px"
                   >
-                    <el-select
-                      v-model="scope.row.colourNumber"
-                      placeholder=""
+                    <el-input
+                      v-model="scope.row.productUnitPrice"
+                      size="small"
+                      oninput="value=value.replace(/[^0-9.]/g,'')"
+                      @change="computedPrice(scope.row)"
                       clearable
-                      filterable
-                      @change="colourNumberChangeHandler(scope.row)"
-                    >
-                      <el-option
-                        v-for="item in colourNumberOptions"
-                        :key="item.materielCode"
-                        :label="item.materieEncoding + item.materieColorNumber"
-                        :value="item.materielCode"
-                      >
-                        <span class="discribe" style="float: left">{{
-                          item.materieEncoding + item.materieColorNumber
-                        }}</span>
-                        <!-- <span
-                        style="float: right; color: #8492a6; font-size: 13px"
-                        >{{ item.materielCode }}</span
-                      > -->
-                      </el-option>
-                    </el-select>
+                    ></el-input>
                   </el-form-item>
                 </template>
               </el-table-column>
+              <el-table-column prop="productAmounts" label="金额">
+                <template slot-scope="scope">
+                  {{ scope.row.productAmounts }}
+                </template>
+              </el-table-column>
+              <el-table-column prop="inventoryBoxNum" label="库存箱数">
+                <template slot-scope="scope">
+                  {{ scope.row.inventoryBoxNum }}
+                </template>
+              </el-table-column>
+              <el-table-column prop="inventoryWeight" label="库存重量/kg">
+                <template slot-scope="scope">
+                  {{ scope.row.inventoryWeight }}
+                </template>
+              </el-table-column>
               <el-table-column prop="remark" label="备注">
                 <template slot-scope="scope">
                   <el-input
@@ -590,7 +664,7 @@
               </el-form-item>
             </el-col> -->
             <el-col :span="24">
-              <el-divider>订单备注</el-divider>
+              <el-divider>备注</el-divider>
             </el-col>
             <el-col :span="24">
               <el-input
@@ -686,6 +760,8 @@ import {
   addProductInvoice,
   updateProductInvoice,
   queryMaterielList,
+  getSaleOrderProductionListDistinct,
+  getProductSpecificationsByProductName,
 } from "@/api/tablelist/commonTable";
 import {
   saleOrderList,
@@ -698,6 +774,8 @@ import {
   cancelRetailOrder,
   deleRetailOrder,
   submitProductInvoice,
+  getProductInventory,
+  updateOrder,
 } from "@/api/system/retailMange.js";
 import { listData } from "@/api/system/tenant/data";
 import { getToken } from "@/utils/auth";
@@ -740,6 +818,26 @@ export default {
   },
   data() {
     return {
+      // 提交  表单数据  start
+      form: {
+        noticeNumber: "", //通知单号
+        noticeDate: "", //通知日期
+        salesman: "", //销售员
+        customerId: "", //客户编号
+        drawer: "", //开票员
+        dispatchNoteRemark: "", //发货单备注
+        billingType: "", //开票类型
+        truckRegistration: "", //货车登记
+        documentType: "", //单据类型
+        sellingUnit: "", //售货单位
+        auditOpinion: "", //审核意见
+        inventoryBoxNum: "", //库存箱数
+        inventoryWeight: "", //库存重量
+
+        batchNumberType: 1, //批次类型
+        computeType: 1, //计算方式
+      },
+      // 提交  表单数据  end
       outStockShow: false, //出库详情弹窗
       totalMoney: "", //合计金额  小写
       createById: "", //创建者id
@@ -897,8 +995,6 @@ export default {
       title: "",
       // 日期范围
       dateRange: [],
-      // 表单参数
-      form: {},
       // cru 弹窗
       open: false,
       // excel共通导入数据
@@ -926,7 +1022,7 @@ export default {
         orderByColumn: "", // 根据某列排序
         isAsc: "", // desc(降序)或 asc(升序)
         saleOrderOrderType: "",
-        status:100,//订单是否已完成/为完成
+        status: 100, //订单是否已完成/为完成
         // 基本查询参数
         basicMap: {
           tableName: "drag_form",
@@ -1005,11 +1101,114 @@ export default {
     ...mapState({
       nickName: (state) => state.user.nickName,
       userInfo: (state) => state.user,
+      username: (state) => state.user.name,
     }),
   },
   methods: {
     orderStartChange(status) {
-      this.getList(false,status );
+      this.getList(false, status);
+    },
+    // 零售订单完成回调
+    async handleComplate(row) {
+      console.log(row);
+      let payload = {
+        id: row.id,
+        status: 6,
+      };
+      let res = await updateOrder(payload);
+      if (res.code == 200) {
+        this.$message({
+          type: "success",
+          message: "订单已完成",
+        });
+        this.getList();
+      } else {
+        this.$message({
+          type: "error",
+          message: "订单已完成失败,请稍后再试",
+        });
+        console.log(res);
+      }
+    },
+    // 更新库存箱数和重量
+    async updateStorage(row) {
+      let {
+        productNo,
+        productType,
+        lotNumber,
+        productName,
+        productSpecifications,
+      } = row;
+      let payload = {
+        productNo,
+        productType,
+        lotNumber,
+        productName,
+        productSpecifications,
+      };
+      let res = await getProductInventory(payload);
+      if ((res.code = 200)) {
+        console.log(res);
+        row.inventoryWeight = res.data.inventoryWeight || 0;
+        row.inventoryBoxNum = res.data.inventoryBoxNum || 0;
+      } else {
+        console.log(res);
+      }
+    },
+    // 规格变化回调
+    handleSpecificationsChange(row) {
+      let { productSpecifications, specificationsList } = row;
+      if (productSpecifications) {
+        let targetItem = specificationsList.find(
+          (item) => item.productSpecifications == productSpecifications
+        );
+        console.log(targetItem);
+        row.productNo = targetItem?.productNo;
+        row.productType = targetItem?.productType;
+      } else {
+        row.productNo = "";
+        row.productType = "";
+      }
+      this.updateStorage(row);
+    },
+    // 新的产品改变回调
+    async newProductChange(productName, row) {
+      // 发请求获取对应的规格数据
+      if (!productName) {
+        row.specificationsList = [];
+        (row.productNo = ""), (row.productType = "");
+        row.productSpecifications = "";
+        return;
+      }
+      // let targetItem = this.productionOptions.find(
+      //   (item) => item.productNo == productNo
+      // );
+      // row.productName = targetItem?.productName;
+      // row.productType = targetItem?.productType;
+      // 获取规格数据
+      let res = await getProductSpecificationsByProductName({
+        productName: productName,
+      });
+      if (res.code == 200) {
+        row.specificationsList = res.data;
+        console.log(row.specificationsList);
+        let defaultItem = row.specificationsList.find(
+          (item) => item.isDefaultSpecifications
+        );
+        if (defaultItem) {
+          row.productSpecifications = defaultItem.productSpecifications;
+          row.productNo = defaultItem.productNo;
+          row.productType = defaultItem.productType;
+        } else {
+          row.productSpecifications =
+            row.specificationsList[0]?.productSpecifications || "";
+          row.productNo = row.specificationsList[0]?.productNo || "";
+          row.productType = row.specificationsList[0]?.productType || "";
+        }
+      } else {
+        row.specificationsList = [];
+      }
+      this.updateStorage(row);
     },
     // 出库单回调
     async myPrintOutBoundHandler(row) {
@@ -1168,10 +1367,13 @@ export default {
         const values = data.map((item) => Number(item[column.property]));
         if (
           index === 1 ||
-          index === 5 ||
-          index === 6 ||
-          index === 7 ||
-          index === 8
+          index === 2 ||
+          index === 3 ||
+          index === 4 ||
+          index === 8 ||
+          index === 9 ||
+          index === 10 ||
+          index === 11
         ) {
           sums[index] = "";
         } else if (!values.every((value) => isNaN(value))) {
@@ -1183,11 +1385,11 @@ export default {
               return prev;
             }
           }, 0);
-          if (index == 3 || index == 4) {
+          if (index == 7 || index == 6) {
             sums[index] = sums[index]?.toFixed(2);
           }
           console.log(sums[index], index);
-          if (index == 4) {
+          if (index == 7) {
             this.totalMoney = sums[index];
           }
         } else {
@@ -1208,6 +1410,7 @@ export default {
         saleProductNo: uuidv4(),
         productNo: "", //货品编号
         productType: "", //类型
+        lotNumber: "", //批号
         productName: "", //货品名称
         productNumber: "", //销售数量
         productWeight: "", //销售重量kg
@@ -1218,6 +1421,11 @@ export default {
         colourNumberLabel: "",
         colourNumber: "", //色号
         remark: "", //备注
+        specificationsList: [],
+        productSpecifications: "", //型号
+
+        inventoryBoxNum: "", //库存箱数
+        inventoryWeight: "", //库存重量
       });
       // 添加校验规则
       this.initTableValidate();
@@ -1365,15 +1573,19 @@ export default {
         } else {
           throw Error("获取下拉框数据失败");
         }
-        let proRes = await getSaleOrderProductionList();
+        let proRes = await getSaleOrderProductionListDistinct();
         if (proRes.code == 200) {
           // let { production, customer } = proRes.data.resultMap;
-          this.allProductionOptions = proRes.data || [];
-          this.productionOptions =
-            this.allProductionOptions.slice(0, 500) || [];
+          this.productionOptions = proRes.data;
         } else {
           throw Error("获取下拉框数据失败");
         }
+        let allProRes = await getSaleOrderProductionList();
+        if (allProRes.code == 200) {
+          this.allProductionOptions = allProRes.data || [];
+        } else {
+          console.log(allProRes);
+        }
       } catch (error) {
         console.log(error);
       }
@@ -1570,8 +1782,23 @@ export default {
           };
           payload.saleProductsList = this.productionTableData;
 
+          // 准备  提交  数据 start
+          this.form.saleCustomNo = saleCustomNo;
+          this.form.salesman = salesman;
+          this.form.noticeDate = moment(new Date()).format("YYYY-MM-DD");
+          this.form.drawer = this.username;
+          this.form.documentType = "1";
+          this.form.billingType = "1";
+          this.form.saleOrderNo = saleNo;
+          this.form.dispatchNoteRemark = orderRemark;
+          this.form.customerId = this.customerOptions.find(
+            (item) => item.customNo == saleCustomNo
+          )?.id;
+          // 准备  提交  数据 end
           if (this.isEdit) {
             payload.id = id;
+            payload.truckRegistration = this.form.truckRegistration;
+            delete payload.status;
             let res = await editRetailOrder(payload);
             if (res.code === 200) {
               this.$message.success("修改成功");
@@ -1586,8 +1813,23 @@ export default {
             let res = await addRetailOrder(payload);
             if (res.code == 200) {
               this.$message.success("添加成功");
-              this.open = false;
-              this.getList();
+              // 准备新增时 提交  数据 start
+              this.form.noticeNumber = this.getOrderNo();
+              this.form.status = 5;
+              this.form.id = res.data;
+              // 提交 新增接口
+              let result = await submitRetailOrder({
+                ...this.form,
+                saleProductInfoList: this.productionTableData,
+              });
+              if (result.code == 200) {
+                this.$message.success("提交成功");
+                this.open = false;
+                this.getList();
+              } else {
+                this.$message.error("提交失败");
+              }
+              // 准备新增时 提交  数据 end
             } else {
               this.$message.error("添加失败");
             }
@@ -1600,6 +1842,32 @@ export default {
         }
       });
     },
+    // 单号生成
+    getOrderNo() {
+      let year = new Date().getFullYear();
+      let month = new Date().getMonth() + 1;
+      let day = new Date().getDate();
+      if (month < 10) {
+        month = "0" + month;
+      }
+      if (day < 10) {
+        day = "0" + day;
+      }
+      let hour = new Date().getHours();
+      let minute = new Date().getMinutes();
+      let second = new Date().getSeconds();
+      if (hour < 10) {
+        hour = "0" + hour;
+      }
+      if (minute < 10) {
+        minute = "0" + minute;
+      }
+      if (second < 10) {
+        second = "0" + second;
+      }
+      let orderNo = year + month + day + hour + minute + second;
+      return orderNo;
+    },
     // 审计   编辑回调
     async handleEdit(index, row) {
       console.log(row);
@@ -1892,7 +2160,7 @@ export default {
       }
     },
     // 初始化数据
-    initData(data) {
+    async initData(data) {
       let {
         id,
         //订单表数据
@@ -1909,6 +2177,7 @@ export default {
         customAddress,
         customCountryType, //国家类型
         contactPerson, //联系人
+        truckRegistration, //货车登记
 
         // 工艺表数据
         remark,
@@ -1916,6 +2185,7 @@ export default {
         // 产品列表
         saleProductsList,
       } = data;
+      this.form.truckRegistration = truckRegistration;
       Object.assign(this.formData, {
         id,
         //订单表数据
@@ -1937,7 +2207,9 @@ export default {
         orderRemark: remark,
       });
       this.customChangeHandler(saleCustomNo);
-      this.productionTableData = saleProductsList.map((item) => {
+      let promiseArr = [],
+        promiseArr2 = [];
+      this.productionTableData = saleProductsList.map((item, index) => {
         let {
           id,
           saleProductNo,
@@ -1952,20 +2224,28 @@ export default {
           colourNumberLabel,
           colourNumber, //色号
           remark, //备注
+          lotNumber, //批号
         } = item;
         let targetItem = this.allProductionOptions.find(
-          (i) => productNo == i.productNo
+          (i) => item.productNo == i.productNo
         );
-        if (
-          !this.productionOptions.some((i) => i.productNo == item.productNo)
-        ) {
-          this.productionOptions.unshift(targetItem);
-        }
         // 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, //货品名称
@@ -1978,8 +2258,27 @@ export default {
           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;
+      });
+      // this.productionTableData.forEach((item, index) => {
+      //   item.inventoryWeight=promiseArr2[index].
+      // });
+
       this.initTableValidate();
     },
     /** 修改按钮操作 */
@@ -2018,7 +2317,7 @@ export default {
         let res = await getRetailOrderInfo(row.id);
         console.log(res);
         if (res.code == 200) {
-          this.initData(res.data);
+          await this.initData(res.data);
           this.printDomData = this.getPrintDom(res.data);
           this.detailShow = true;
           this.$nextTick(() => {
@@ -2098,7 +2397,8 @@ export default {
         // 工艺表数据
         orderRemark,
       } = this.formData;
-      this.productionTableData;
+      console.log(this.form, this.productionTableData);
+      let { truckRegistration } = this.form;
       let customData = this.customerOptions.find(
         (item) => item.customNo == saleCustomNo
       );
@@ -2109,43 +2409,46 @@ export default {
             <div style="text-align:center;">销售合同审计单</div>
             <tbody>
                 <tr>
-                    <td width="600px" colspan="4">合同号:${saleNo}</td>
-                    <td width="600px" colspan="4">日期:${saleDate.replace(
+                    <td width="600px" colspan="5">合同号:${saleNo}</td>
+                    <td width="600px" colspan="6">日期:${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="3">客户名称:</td>
+                    <td width="300px" colspan="3">${customerName}</td>
                     <td colspan="2">业务员:</td>
-                    <td colspan="2">${salesman}</td>
+                    <td colspan="3">${salesman}</td>
 
                 </tr>
                 <tr align="center">
-                    <td width="300px" colspan="2">客户地址:</td>
-                    <td width="300px" colspan="2">${customAddress}</td>
+                    <td width="300px" colspan="3">客户地址:</td>
+                    <td width="300px" colspan="3">${customAddress}</td>
                     <td width="300px" colspan="2">客户国别:</td>
-                    <td width="300px" colspan="2">${customCountryType}</td>
+                    <td width="300px" colspan="3">${customCountryType}</td>
                 </tr>
                 <tr align="center">
-                    <td width="300px" colspan="2">联系人:</td>
-                    <td width="150px" colspan="1">${contactPerson}</td>
+                    <td width="300px" colspan="3">联系人:</td>
+                    <td width="150px" colspan="3">${contactPerson}</td>
                     <td  colspan="2">合计金额(大写):</td>
                     <td colspan="3">${saleAmountInWords}</td>
                 </tr>
                 <tr align="center">
-                    <td colspan="8">货品明细</td>
+                    <td colspan="11">货品明细</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="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>
+                    <td width="150px">库存重量/kg</td>
+                    <td width="100px">备注</td>
                 </tr>`;
       let amountTotal = 0,
         singlTotal = 0,
@@ -2167,13 +2470,16 @@ export default {
         let productName = productData ? productData.productName : "";
         let productType = productData ? productData.productType : "";
         printStr += `<tr align="center">
-                    <td>${productName}</td>
-                    <td>${productType}</td>
+                    <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.sliceTypeLabel}</td>
-                    <td>${item.colourNumberLabel}</td>
+                    <td>${item.inventoryBoxNum}</td>
+                    <td>${item.inventoryWeight}</td>
                     <td>${item.remark}</td>
                 </tr>`;
       }
@@ -2185,6 +2491,9 @@ export default {
         <tr align="center">
           <td>小计:</td>
            <td></td>
+           <td></td>
+          <td></td>
+          <td></td>
           <td>${amountTotal}</td>
           <td>${singlTotal}</td>
           <td>${moneyTotal}</td>
@@ -2193,7 +2502,7 @@ export default {
           <td></td>
         </tr>`;
       printStr += `<tr align="left">
-                    <td colspan="8">订单备注:${orderRemark}</td>
+                    <td colspan="11">订单备注:${orderRemark}</td>
                 </tr>
                 </tbody>
         </table>`;
@@ -2782,6 +3091,7 @@ export default {
         // row.colourNumberLabel = this.colourNumberOptions.find(
         //   (item) => item.materielCode == colourNumber
         // )?.materieColorNumber;
+        this.updateStorage(row);
       }
     },
     // 打印回调