Ver Fonte

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	zkqy-custom-business/src/main/resources/mapper/business/SaleProductsMapper.xml
hmc há 1 ano atrás
pai
commit
b5dd2b9df9
68 ficheiros alterados com 5261 adições e 652 exclusões
  1. 11 0
      zkqy-admin/src/main/java/com/zkqy/web/controller/system/SysUserController.java
  2. 33 3
      zkqy-custom-business/src/main/java/com/zkqy/business/controller/CustomerController.java
  3. 23 18
      zkqy-custom-business/src/main/java/com/zkqy/business/controller/ProductCodeListController.java
  4. 21 19
      zkqy-custom-business/src/main/java/com/zkqy/business/controller/ProductCodeListInfoController.java
  5. 31 17
      zkqy-custom-business/src/main/java/com/zkqy/business/controller/ProductInventoryController.java
  6. 1 1
      zkqy-custom-business/src/main/java/com/zkqy/business/controller/ProductInvoiceController.java
  7. 11 3
      zkqy-custom-business/src/main/java/com/zkqy/business/controller/ProductOutboundRecordController.java
  8. 45 1
      zkqy-custom-business/src/main/java/com/zkqy/business/controller/SaleOrderController.java
  9. 2 2
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/Customer.java
  10. 76 3
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductCodeList.java
  11. 3 3
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductHandsetOutboundRecord.java
  12. 6 6
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductInventory.java
  13. 3 3
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductOutboundRecord.java
  14. 3 3
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductWarehousingRecord.java
  15. 0 1
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/SaleOrder.java
  16. 13 2
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/SaleProducts.java
  17. 25 3
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/ProductCodeListVO.java
  18. 11 1
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/ProductInvoiceVO.java
  19. 13 0
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/SaleOrderVO.java
  20. 5 0
      zkqy-custom-business/src/main/java/com/zkqy/business/mapper/CustomerMapper.java
  21. 1 1
      zkqy-custom-business/src/main/java/com/zkqy/business/mapper/ProductCodeListMapper.java
  22. 7 0
      zkqy-custom-business/src/main/java/com/zkqy/business/mapper/ProductInvoiceMapper.java
  23. 15 0
      zkqy-custom-business/src/main/java/com/zkqy/business/mapper/ProductOutboundRecordMapper.java
  24. 7 0
      zkqy-custom-business/src/main/java/com/zkqy/business/mapper/ProductWarehousingRecordMapper.java
  25. 5 0
      zkqy-custom-business/src/main/java/com/zkqy/business/mapper/SaleOrderMapper.java
  26. 12 0
      zkqy-custom-business/src/main/java/com/zkqy/business/mapper/SaleProductsMapper.java
  27. 5 0
      zkqy-custom-business/src/main/java/com/zkqy/business/service/ICustomerService.java
  28. 18 9
      zkqy-custom-business/src/main/java/com/zkqy/business/service/IProductCodeListInfoService.java
  29. 10 1
      zkqy-custom-business/src/main/java/com/zkqy/business/service/IProductCodeListService.java
  30. 20 9
      zkqy-custom-business/src/main/java/com/zkqy/business/service/IProductInventoryService.java
  31. 2 1
      zkqy-custom-business/src/main/java/com/zkqy/business/service/IProductInvoiceService.java
  32. 25 9
      zkqy-custom-business/src/main/java/com/zkqy/business/service/IProductOutboundRecordService.java
  33. 28 1
      zkqy-custom-business/src/main/java/com/zkqy/business/service/ISaleOrderService.java
  34. 5 0
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/CustomerServiceImpl.java
  35. 28 21
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductCodeListInfoServiceImpl.java
  36. 65 61
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductCodeListServiceImpl.java
  37. 109 56
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductInventoryServiceImpl.java
  38. 7 1
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductInvoiceServiceImpl.java
  39. 36 22
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductOutboundRecordServiceImpl.java
  40. 117 2
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/SaleOrderServiceImpl.java
  41. 43 0
      zkqy-custom-business/src/main/resources/mapper/business/CustomerMapper.xml
  42. 2 1
      zkqy-custom-business/src/main/resources/mapper/business/ProductCodeListMapper.xml
  43. 6 13
      zkqy-custom-business/src/main/resources/mapper/business/ProductInventoryMapper.xml
  44. 5 0
      zkqy-custom-business/src/main/resources/mapper/business/ProductInvoiceMapper.xml
  45. 181 111
      zkqy-custom-business/src/main/resources/mapper/business/ProductOutboundRecordMapper.xml
  46. 10 12
      zkqy-custom-business/src/main/resources/mapper/business/ProductWarehousingRecordMapper.xml
  47. 21 14
      zkqy-custom-business/src/main/resources/mapper/business/SaleOrderMapper.xml
  48. 80 15
      zkqy-custom-business/src/main/resources/mapper/business/SaleProductsMapper.xml
  49. 5 0
      zkqy-system/src/main/java/com/zkqy/system/mapper/SysUserMapper.java
  50. 8 0
      zkqy-system/src/main/java/com/zkqy/system/service/ISysUserService.java
  51. 5 0
      zkqy-system/src/main/java/com/zkqy/system/service/impl/SysUserServiceImpl.java
  52. 12 0
      zkqy-system/src/main/resources/mapper/system/SysUserMapper.xml
  53. 12 1
      zkqy-ui/src/api/codeListManage/productCodeList.js
  54. 11 1
      zkqy-ui/src/api/system/ProductWarehousingRecord.js
  55. 7 0
      zkqy-ui/src/api/system/customer.js
  56. 76 3
      zkqy-ui/src/api/system/retailMange.js
  57. 60 4
      zkqy-ui/src/utils/other.js
  58. 8 7
      zkqy-ui/src/utils/print/codeListPrint.js
  59. 22 10
      zkqy-ui/src/utils/print/outBoundPrint.js
  60. 1 1
      zkqy-ui/src/views/bussiness/processMange_line.vue
  61. 51 6
      zkqy-ui/src/views/orderMange/components/dialogForm/OutBound.vue
  62. 106 0
      zkqy-ui/src/views/orderMange/components/dialogForm/OutStock.vue
  63. 492 0
      zkqy-ui/src/views/orderMange/components/dialogForm/RetailProvide.vue
  64. 102 0
      zkqy-ui/src/views/orderMange/customerMange/index.vue
  65. 91 11
      zkqy-ui/src/views/orderMange/index.vue
  66. 32 22
      zkqy-ui/src/views/orderMange/productInRecord/index.vue
  67. 1 1
      zkqy-ui/src/views/orderMange/productOutRecord/index.vue
  68. 2953 136
      zkqy-ui/src/views/orderMange/retailMange/index.vue

+ 11 - 0
zkqy-admin/src/main/java/com/zkqy/web/controller/system/SysUserController.java

@@ -285,4 +285,15 @@ public class SysUserController extends BaseController {
         return AjaxResult.success(userService.isExistUser(userName));
     }
 
+
+    /**
+     * 根据角色获取用户信息
+     */
+    @GetMapping("/getRoleUser/{roleKey}")
+    public AjaxResult getRoleUser(@PathVariable("roleKey") String roleKey) {
+        return AjaxResult.success(userService.selectUserListByRoleKey(roleKey,getTenantId()));
+    }
+
+
+
 }

+ 33 - 3
zkqy-custom-business/src/main/java/com/zkqy/business/controller/CustomerController.java

@@ -2,6 +2,9 @@ package com.zkqy.business.controller;
 
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
+
+import com.zkqy.common.core.domain.entity.SysUser;
+import com.zkqy.common.utils.DateUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -15,6 +18,7 @@ import com.zkqy.business.domain.Customer;
 import com.zkqy.business.service.ICustomerService;
 import com.zkqy.common.utils.poi.ExcelUtil;
 import com.zkqy.common.core.page.TableDataInfo;
+import org.springframework.web.multipart.MultipartFile;
 
 /**
  * 客户Controller
@@ -57,9 +61,35 @@ public class CustomerController extends BaseController
         util.exportExcel(response, list, "客户数据");
     }
 
-    /**
-     * 获取客户详细信息
-     */
+
+
+
+
+    @Log(title = "客户管理", businessType = BusinessType.IMPORT)
+    //@PreAuthorize("@ss.hasPermi('system:user:import')")
+    @PostMapping("/importData")
+    public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
+        ExcelUtil<Customer> util = new ExcelUtil<Customer>(Customer.class);
+        List<Customer> userList = util.importExcel(file.getInputStream());
+        userList.forEach(customer -> {
+            customer.setCreateBy(getUsername());
+            customer.setCreateById(getUserId());
+            customer.setCreateTime(DateUtils.getNowDate());
+        });
+        return success(customerService.batchInsertCustomer(userList));
+    }
+
+
+    @PostMapping("/importTemplate")
+    public void importTemplate(HttpServletResponse response) {
+        ExcelUtil<Customer> util = new ExcelUtil<Customer>(Customer.class);
+        util.importTemplateExcel(response, "用户数据");
+    }
+
+
+        /**
+         * 获取客户详细信息
+         */
 //    @PreAuthorize("@ss.hasPermi('system:customer:query')")
     @GetMapping(value = "/{id}")
     @ApiOperation(value = "获取客户详细信息")

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

@@ -41,8 +41,7 @@ import com.zkqy.common.core.page.TableDataInfo;
 @RestController
 @RequestMapping("/system/productCodeList")
 @Api(value = "/system/productCodeList", description = "产品码单-接口")
-public class ProductCodeListController extends BaseController
-{
+public class ProductCodeListController extends BaseController {
     @Autowired
     private IProductCodeListService productCodeListService;
 
@@ -55,8 +54,7 @@ public class ProductCodeListController extends BaseController
     //@PreAuthorize("@ss.hasPermi('system:productCodeList:list')")
     @GetMapping("/list")
     @ApiOperation(value = "查询产品码单列表")
-    public TableDataInfo list(ProductCodeListVO vo)
-    {
+    public TableDataInfo list(ProductCodeListVO vo) {
         startPage();
         List<ProductCodeListVO> list = productCodeListService.selectProductCodeListList(vo);
         return getDataTable(list);
@@ -84,8 +82,7 @@ public class ProductCodeListController extends BaseController
     //@PreAuthorize("@ss.hasPermi('system:productCodeList:query')")
     @GetMapping(value = "/{id}")
     @ApiOperation(value = "获取产品码单详细信息")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
         return success(productCodeListService.selectProductCodeListById(id));
     }
 
@@ -93,7 +90,7 @@ public class ProductCodeListController extends BaseController
      * 根据qrCode查询产品码单信息
      */
     @GetMapping("/queryCodeListByQrCode/{qrCode}")
-    public AjaxResult queryCodeListByQrCode(@PathVariable("qrCode") String qrCode){
+    public AjaxResult queryCodeListByQrCode(@PathVariable("qrCode") String qrCode) {
         return success(productCodeListService.selectProductCodeListByQrCode(qrCode));
     }
 
@@ -105,8 +102,7 @@ public class ProductCodeListController extends BaseController
     @Log(title = "产品码单", businessType = BusinessType.INSERT)
     @PostMapping
     @ApiOperation(value = "新增产品码单")
-    public AjaxResult add(@RequestBody ProductCodeListVO vo)
-    {
+    public AjaxResult add(@RequestBody ProductCodeListVO vo) {
         return AjaxResult.success(productCodeListService.insertProductCodeList(vo));
     }
 
@@ -117,13 +113,12 @@ public class ProductCodeListController extends BaseController
     @Log(title = "产品码单", businessType = BusinessType.UPDATE)
     @PutMapping
     @ApiOperation(value = "修改产品码单")
-    public AjaxResult edit(@RequestBody ProductCodeListVO vo)
-    {
+    public AjaxResult edit(@RequestBody ProductCodeListVO vo) {
         //查询成品库存表,查看当前码单是否已经入库,入库则不能修改
         ProductWarehousingRecord productWarehousingRecord = new ProductWarehousingRecord();
         productWarehousingRecord.setQrCode(vo.getQrCode());
         List<ProductWarehousingRecord> productWarehousingRecordList = productWarehousingRecordService.selectProductWarehousingRecordList(productWarehousingRecord);
-        if(productWarehousingRecordList.size() > 0){
+        if (productWarehousingRecordList.size() > 0) {
             return AjaxResult.warn("该码单已入库,不能修改!");
         }
 
@@ -137,8 +132,7 @@ public class ProductCodeListController extends BaseController
     @Log(title = "产品码单", businessType = BusinessType.DELETE)
     @DeleteMapping("/{ids}")
     @ApiOperation(value = "删除产品码单")
-    public AjaxResult remove(@PathVariable String[] ids)
-    {
+    public AjaxResult remove(@PathVariable String[] ids) {
         return toAjax(productCodeListService.deleteProductCodeListByIds(ids));
     }
 
@@ -146,15 +140,15 @@ public class ProductCodeListController extends BaseController
      * 生产完成产品列表
      */
     @GetMapping("/finishedProductList")
-    public AjaxResult finishedProductList(){
-        return AjaxResult.success(productCodeListService.selectFinishedProduct());
+    public AjaxResult finishedProductList(ProductCodeList productCodeList) {
+        return AjaxResult.success(productCodeListService.selectFinishedProduct(productCodeList));
     }
 
     /**
      * 获取码单号
      */
     @GetMapping("/getQrCode")
-    public AjaxResult getQrCode(){
+    public AjaxResult getQrCode() {
         return AjaxResult.success(productCodeListService.selectMaxCodeList());
     }
 
@@ -163,8 +157,19 @@ public class ProductCodeListController extends BaseController
      * 获取当前码单完整信息
      */
     @GetMapping("/getProductCodeListById/{id}")
-    public AjaxResult getProductCodeListById(@PathVariable("id") Long id){
+    public AjaxResult getProductCodeListById(@PathVariable("id") Long id) {
         return AjaxResult.success(productCodeListService.getProductCodeListById(id));
     }
 
+    /**
+     * 删除二维码信息、更新库存、入库记录等
+     *
+     * @param productCodeListVO
+     * @return
+     */
+    @DeleteMapping("/removeProductCodeASInventory")
+    @ApiOperation(value = "删除产品码单详情")
+    public AjaxResult removeInventory(@RequestBody ProductCodeListVO productCodeListVO) {
+        return productCodeListService.deleteProductCodeListInfoByInfo(productCodeListVO);
+    }
 }

+ 21 - 19
zkqy-custom-business/src/main/java/com/zkqy/business/controller/ProductCodeListInfoController.java

@@ -2,6 +2,8 @@ package com.zkqy.business.controller;
 
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
+
+import com.zkqy.business.domain.vo.ProductCodeListVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -32,19 +34,17 @@ import com.zkqy.common.core.page.TableDataInfo;
 @RestController
 @RequestMapping("/system/ProductCodeListInfo")
 @Api(value = "/system/ProductCodeListInfo", description = "产品码单详情-接口")
-public class ProductCodeListInfoController extends BaseController
-{
+public class ProductCodeListInfoController extends BaseController {
     @Autowired
     private IProductCodeListInfoService productCodeListInfoService;
 
-/**
- * 查询产品码单详情列表
- */
+    /**
+     * 查询产品码单详情列表
+     */
 //@PreAuthorize("@ss.hasPermi('system:ProductCodeListInfo:list')")
-@GetMapping("/list")
-@ApiOperation(value = "查询产品码单详情列表")
-    public TableDataInfo list(ProductCodeListInfo productCodeListInfo)
-    {
+    @GetMapping("/list")
+    @ApiOperation(value = "查询产品码单详情列表")
+    public TableDataInfo list(ProductCodeListInfo productCodeListInfo) {
         startPage();
         List<ProductCodeListInfo> list = productCodeListInfoService.selectProductCodeListInfoList(productCodeListInfo);
         return getDataTable(list);
@@ -57,8 +57,7 @@ public class ProductCodeListInfoController extends BaseController
     @Log(title = "产品码单详情", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     @ApiOperation(value = "导出产品码单详情列表")
-    public void export(HttpServletResponse response, ProductCodeListInfo productCodeListInfo)
-    {
+    public void export(HttpServletResponse response, ProductCodeListInfo productCodeListInfo) {
         List<ProductCodeListInfo> list = productCodeListInfoService.selectProductCodeListInfoList(productCodeListInfo);
         ExcelUtil<ProductCodeListInfo> util = new ExcelUtil<ProductCodeListInfo>(ProductCodeListInfo.class);
         util.exportExcel(response, list, "产品码单详情数据");
@@ -70,8 +69,7 @@ public class ProductCodeListInfoController extends BaseController
     //@PreAuthorize("@ss.hasPermi('system:ProductCodeListInfo:query')")
     @GetMapping(value = "/{id}")
     @ApiOperation(value = "获取产品码单详情详细信息")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
         return success(productCodeListInfoService.selectProductCodeListInfoById(id));
     }
 
@@ -82,8 +80,7 @@ public class ProductCodeListInfoController extends BaseController
     @Log(title = "产品码单详情", businessType = BusinessType.INSERT)
     @PostMapping
     @ApiOperation(value = "新增产品码单详情")
-    public AjaxResult add(@RequestBody List<ProductCodeListInfo> productCodeListInfoList)
-    {
+    public AjaxResult add(@RequestBody List<ProductCodeListInfo> productCodeListInfoList) {
         return toAjax(productCodeListInfoService.insertProductCodeListInfo(productCodeListInfoList));
     }
 
@@ -94,8 +91,7 @@ public class ProductCodeListInfoController extends BaseController
     @Log(title = "产品码单详情", businessType = BusinessType.UPDATE)
     @PutMapping
     @ApiOperation(value = "修改产品码单详情")
-    public AjaxResult edit(@RequestBody ProductCodeListInfo productCodeListInfo)
-    {
+    public AjaxResult edit(@RequestBody ProductCodeListInfo productCodeListInfo) {
         return toAjax(productCodeListInfoService.updateProductCodeListInfo(productCodeListInfo));
     }
 
@@ -106,8 +102,14 @@ public class ProductCodeListInfoController extends BaseController
     @Log(title = "产品码单详情", businessType = BusinessType.DELETE)
     @DeleteMapping("/{ids}")
     @ApiOperation(value = "删除产品码单详情")
-    public AjaxResult remove(@PathVariable List<Long> ids)
-    {
+    public AjaxResult remove(@PathVariable List<Long> ids) {
         return toAjax(productCodeListInfoService.deleteProductCodeListInfoByIds(ids));
     }
+
+//    @Log(title = "产品码单详情", businessType = BusinessType.DELETE)
+//    @DeleteMapping("/removeProductCodeASInventory")
+//    @ApiOperation(value = "删除产品码单详情")
+//    public AjaxResult removeInventory(ProductCodeListVO productCodeListVO) {
+//        return toAjax(productCodeListInfoService.deleteProductCodeListInfoByInfo(productCodeListVO));
+//    }
 }

+ 31 - 17
zkqy-custom-business/src/main/java/com/zkqy/business/controller/ProductInventoryController.java

@@ -35,8 +35,7 @@ import com.zkqy.common.core.page.TableDataInfo;
 @RestController
 @RequestMapping("/system/ProductInventory")
 @Api(value = "/system/ProductInventory", description = "产品库存-接口")
-public class ProductInventoryController extends BaseController
-{
+public class ProductInventoryController extends BaseController {
     @Autowired
     private IProductInventoryService productInventoryService;
 
@@ -46,8 +45,7 @@ public class ProductInventoryController extends BaseController
 //    @PreAuthorize("@ss.hasPermi('system:ProductInventory:list')")
     @GetMapping("/list")
     @ApiOperation(value = "查询产品库存列表")
-    public TableDataInfo list(ProductInventory productInventory)
-    {
+    public TableDataInfo list(ProductInventory productInventory) {
         startPage();
         List<ProductInventory> list = productInventoryService.selectProductInventoryList(productInventory);
         return getDataTable(list);
@@ -60,8 +58,7 @@ public class ProductInventoryController extends BaseController
     @Log(title = "产品库存", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     @ApiOperation(value = "导出产品库存列表")
-    public void export(HttpServletResponse response, ProductInventory productInventory)
-    {
+    public void export(HttpServletResponse response, ProductInventory productInventory) {
         List<ProductInventory> list = productInventoryService.selectProductInventoryList(productInventory);
         ExcelUtil<ProductInventory> util = new ExcelUtil<ProductInventory>(ProductInventory.class);
         util.exportExcel(response, list, "产品库存数据");
@@ -73,8 +70,7 @@ public class ProductInventoryController extends BaseController
 //    @PreAuthorize("@ss.hasPermi('system:ProductInventory:query')")
     @GetMapping(value = "/{id}")
     @ApiOperation(value = "获取产品库存详细信息")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
         return success(productInventoryService.selectProductInventoryById(id));
     }
 
@@ -85,8 +81,7 @@ public class ProductInventoryController extends BaseController
     @Log(title = "产品库存", businessType = BusinessType.INSERT)
     @PostMapping
     @ApiOperation(value = "新增产品库存")
-    public AjaxResult add(@RequestBody ProductInventory productInventory)
-    {
+    public AjaxResult add(@RequestBody ProductInventory productInventory) {
         return toAjax(productInventoryService.insertProductInventory(productInventory));
     }
 
@@ -97,8 +92,7 @@ public class ProductInventoryController extends BaseController
     @Log(title = "产品库存", businessType = BusinessType.UPDATE)
     @PutMapping
     @ApiOperation(value = "修改产品库存")
-    public AjaxResult edit(@RequestBody ProductInventory productInventory)
-    {
+    public AjaxResult edit(@RequestBody ProductInventory productInventory) {
         return toAjax(productInventoryService.updateProductInventory(productInventory));
     }
 
@@ -109,8 +103,7 @@ public class ProductInventoryController 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(productInventoryService.deleteProductInventoryByIds(ids));
     }
 
@@ -118,7 +111,7 @@ public class ProductInventoryController extends BaseController
      * 产品入库
      */
     @PostMapping("/productStorage")
-    public AjaxResult productStorage(@RequestBody List<ProductCodeListVO> productCodeListVOList){
+    public AjaxResult productStorage(@RequestBody List<ProductCodeListVO> productCodeListVOList) {
         productInventoryService.productStorage(productCodeListVOList);
         return AjaxResult.success();
     }
@@ -127,7 +120,7 @@ public class ProductInventoryController extends BaseController
      * 产品出库
      */
     @PostMapping("/productOutStorage")
-    public AjaxResult productOutStorage(@RequestBody List<ProductCodeListVO> productCodeListVOList){
+    public AjaxResult productOutStorage(@RequestBody List<ProductCodeListVO> productCodeListVOList) {
         productInventoryService.productOutStorage(productCodeListVOList);
         return AjaxResult.success();
     }
@@ -136,10 +129,31 @@ public class ProductInventoryController extends BaseController
      * 通知单出库接口
      */
     @PostMapping("/noticeOutStorage")
-    public AjaxResult noticeOutStorage(@RequestBody ProductInvoice productInvoice){
+    public AjaxResult noticeOutStorage(@RequestBody ProductInvoice productInvoice) {
         productInventoryService.noticeOutStorage(productInvoice);
         return AjaxResult.success();
     }
 
+    /**
+     * 删除错误入库
+     *
+     * @param productCodeListVO
+     * @return
+     */
+    @DeleteMapping("/deleteProductInventory")
+    public AjaxResult deleteProductInventory(@RequestBody ProductCodeListVO productCodeListVO) {
+        return productInventoryService.deleteInventorByProductCodeListVO(productCodeListVO);
+    }
+
+    /**
+     * 获取货品库存箱数重量
+     */
+    @PostMapping("/getProductInventory")
+    public AjaxResult getProductInventory(@RequestBody ProductInventory productInventory){
+        return AjaxResult.success(productInventoryService.getProductInventory(productInventory));
+    }
+
+
+
 
 }

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

@@ -111,7 +111,7 @@ public class ProductInvoiceController extends BaseController
     }
 
     /**
-     * 查询发货单货品信息
+     * 查询发货单货品信息/销售单&零售单
      */
     @GetMapping("/productInvoiceInfo")
     public AjaxResult productInvoiceInfo(@RequestParam("saleOrderNo") String saleOrderNo)

+ 11 - 3
zkqy-custom-business/src/main/java/com/zkqy/business/controller/ProductOutboundRecordController.java

@@ -55,9 +55,9 @@ public class ProductOutboundRecordController extends BaseController
         return getDataTable(list);
     }
 
-    /**
-     * 导出成品出库记录列表
-     */
+//    /**
+//     * 导出成品出库记录列表
+//     */
 //    @PreAuthorize("@ss.hasPermi('system:ProductOutboundRecord:export')")
 //    @Log(title = "成品出库记录", businessType = BusinessType.EXPORT)
 //    @PostMapping("/export")
@@ -139,4 +139,12 @@ public class ProductOutboundRecordController extends BaseController
         return success(true);
     }
 
+    /**
+     * 销售单/零售单出库明细记录
+     */
+    @GetMapping("/outboundDetails")
+    public AjaxResult outboundDetails(@RequestParam String saleOrderNo){
+        return AjaxResult.success(productOutboundRecordService.outboundDetails(saleOrderNo));
+    }
+
 }

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

@@ -3,6 +3,7 @@ package com.zkqy.business.controller;
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
 
+import com.zkqy.business.domain.ProductInvoice;
 import com.zkqy.business.domain.SaleProducts;
 import com.zkqy.business.domain.vo.SaleOrderVO;
 import com.zkqy.business.domain.vo.SaleProductsVo;
@@ -132,7 +133,7 @@ public class SaleOrderController extends BaseController {
     }
 
     /**
-     * 销售单列表--权限过滤
+     * 销售单/零售单列表--权限过滤
      */
     @GetMapping("/saleOrderList")
     public TableDataInfo saleOrderList(SaleOrder saleOrder){
@@ -141,6 +142,49 @@ public class SaleOrderController extends BaseController {
         return getDataTable(list);
     }
 
+    /**
+     * 新增零售单
+     */
+    @PostMapping("/addRetailOrder")
+    public AjaxResult addRetailOrder(@RequestBody SaleOrderVO vo) {
+        return success(saleOrderService.addRetailOrder(vo));
+    }
+
+
+    /**
+     * 零售单详情
+     */
+    @GetMapping("/getRetailOrderInfo/{id}")
+    public AjaxResult getRetailOrderInfo(@PathVariable Long id) {
+        return success(saleOrderService.getRetailOrderInfo(id));
+    }
+
+    /**
+     * 修改零售单
+     */
+    @PutMapping("/editRetailOrder")
+    public AjaxResult editRetailOrder(@RequestBody SaleOrderVO vo) {
+        return toAjax(saleOrderService.editRetailOrder(vo));
+    }
+
+    /**
+     * 零售单提交
+     */
+    @PostMapping("/submitRetailOrder")
+    public AjaxResult submitRetailOrder(@RequestBody ProductInvoice productInvoice) {
+        return toAjax(saleOrderService.submitRetailOrder(productInvoice));
+    }
+
+    /**
+     * 零售单撤销
+     */
+    @PostMapping("/cancelRetailOrder")
+    public AjaxResult cancelRetailOrder(@RequestBody ProductInvoice productInvoice) {
+        return toAjax(saleOrderService.cancelRetailOrder(productInvoice));
+    }
+
+
+
 
 
 }

+ 2 - 2
zkqy-custom-business/src/main/java/com/zkqy/business/domain/Customer.java

@@ -39,11 +39,11 @@ public class Customer extends BaseEntity
     private String customMail;
 
     /** 客户类型(国内/国外/内加工) */
-    @Excel(name = "客户类型", readConverterExp = "国=内/国外/内加工")
+    @Excel(name = "客户类型")
     private String customType;
 
     /** 客户等级(一级/二级/三级) */
-    @Excel(name = "客户等级", readConverterExp = "一=级/二级/三级")
+    @Excel(name = "客户等级")
     private String customGrade;
 
     /** 地址信息 */

+ 76 - 3
zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductCodeList.java

@@ -2,6 +2,7 @@ package com.zkqy.business.domain;
 
 import java.util.Date;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.zkqy.business.domain.vo.ProductCodeListVO;
 import com.zkqy.common.core.domain.BaseEntity;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
@@ -55,7 +56,7 @@ public class ProductCodeList extends BaseEntity
     private Date productionDate;
 
     /** 机台 */
-    private String machineTool;
+    private Long machineTool;
 
     /** 毛重 */
     private Double grossWeight;
@@ -186,11 +187,11 @@ public class ProductCodeList extends BaseEntity
         this.productionDate = productionDate;
     }
 
-    public String getMachineTool() {
+    public Long getMachineTool() {
         return machineTool;
     }
 
-    public void setMachineTool(String machineTool) {
+    public void setMachineTool(Long machineTool) {
         this.machineTool = machineTool;
     }
 
@@ -392,4 +393,76 @@ public class ProductCodeList extends BaseEntity
                 ", totalGrossWeight=" + totalGrossWeight +
                 '}';
     }
+
+    public ProductCodeList() {
+    }
+
+
+    public ProductCodeList(ProductCodeListVO productCodeListVO) {
+        this.id = productCodeListVO.getId();
+        this.qrCode = productCodeListVO.getQrCode();
+        this.lotNum = productCodeListVO.getLotNum();
+        this.productId = productCodeListVO.getProductId();
+        this.productColour = productCodeListVO.getProductColour();
+        this.levels = productCodeListVO.getLevels();
+        this.canisterNum = productCodeListVO.getCanisterNum();
+        this.boxNum = productCodeListVO.getBoxNum();
+        this.suttle = productCodeListVO.getSuttle();
+        this.productionDate = productCodeListVO.getProductionDate();
+        this.machineTool = productCodeListVO.getMachineTool();
+        this.grossWeight = productCodeListVO.getGrossWeight();
+        this.packaging = productCodeListVO.getPackaging();
+        this.workShifts = productCodeListVO.getWorkShifts();
+        this.foreignTradeNumber = productCodeListVO.getForeignTradeNumber();
+        this.canisterWeight = productCodeListVO.getCanisterWeight();
+        this.boxWeight = productCodeListVO.getBoxWeight();
+        this.tubeColor = productCodeListVO.getTubeColor();
+        this.comPort = productCodeListVO.getComPort();
+        this.printFormat = productCodeListVO.getPrintFormat();
+        this.packagingType = productCodeListVO.getPackagingType();
+        this.storageLocation = productCodeListVO.getStorageLocation();
+        this.warehouseregionId = productCodeListVO.getWarehouseregionId();
+        this.delFlag = productCodeListVO.getDelFlag();
+        this.createById = productCodeListVO.getCreateById();
+        this.updateById = productCodeListVO.getUpdateById();
+        this.totalCanisterNum = productCodeListVO.getTotalCanisterNum();
+        this.totalBoxNum = productCodeListVO.getTotalBoxNum();
+        this.totalSuttle = productCodeListVO.getTotalSuttle();
+        this.totalGrossWeight = productCodeListVO.getTotalGrossWeight();
+    }
+
+    public ProductCodeList(Long id, String qrCode, String lotNum, Long productId, String productColour, String levels, Integer canisterNum, Integer boxNum, Double suttle, Date productionDate, Long machineTool, Double grossWeight, String packaging, String workShifts, String foreignTradeNumber, Double canisterWeight, Double boxWeight, String tubeColor, String comPort, String printFormat, String packagingType, String storageLocation, Long warehouseregionId, String delFlag, Long createById, Long updateById, Integer totalCanisterNum, Integer totalBoxNum, Double totalSuttle, Double totalGrossWeight) {
+        this.id = id;
+        this.qrCode = qrCode;
+        this.lotNum = lotNum;
+        this.productId = productId;
+        this.productColour = productColour;
+        this.levels = levels;
+        this.canisterNum = canisterNum;
+        this.boxNum = boxNum;
+        this.suttle = suttle;
+        this.productionDate = productionDate;
+        this.machineTool = machineTool;
+        this.grossWeight = grossWeight;
+        this.packaging = packaging;
+        this.workShifts = workShifts;
+        this.foreignTradeNumber = foreignTradeNumber;
+        this.canisterWeight = canisterWeight;
+        this.boxWeight = boxWeight;
+        this.tubeColor = tubeColor;
+        this.comPort = comPort;
+        this.printFormat = printFormat;
+        this.packagingType = packagingType;
+        this.storageLocation = storageLocation;
+        this.warehouseregionId = warehouseregionId;
+        this.delFlag = delFlag;
+        this.createById = createById;
+        this.updateById = updateById;
+        this.totalCanisterNum = totalCanisterNum;
+        this.totalBoxNum = totalBoxNum;
+        this.totalSuttle = totalSuttle;
+        this.totalGrossWeight = totalGrossWeight;
+    }
+
+
 }

+ 3 - 3
zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductHandsetOutboundRecord.java

@@ -59,7 +59,7 @@ public class ProductHandsetOutboundRecord extends BaseEntity
 
     /** 机台 */
     @Excel(name = "机台")
-    private String machineTool;
+    private Long machineTool;
 
     /** 毛重 */
     @Excel(name = "毛重")
@@ -228,12 +228,12 @@ public class ProductHandsetOutboundRecord extends BaseEntity
     {
         return productionDate;
     }
-    public void setMachineTool(String machineTool) 
+    public void setMachineTool(Long machineTool)
     {
         this.machineTool = machineTool;
     }
 
-    public String getMachineTool() 
+    public Long getMachineTool()
     {
         return machineTool;
     }

+ 6 - 6
zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductInventory.java

@@ -46,7 +46,7 @@ public class ProductInventory extends BaseEntity
 
     /** 净重 */
     @Excel(name = "净重")
-    private Long suttle;
+    private Double suttle;
 
     /** 生产日期 */
     @JsonFormat(pattern = "yyyy-MM-dd")
@@ -59,7 +59,7 @@ public class ProductInventory extends BaseEntity
 
     /** 机台 */
     @Excel(name = "机台")
-    private String machineTool;
+    private Long machineTool;
 
     /** 毛重 */
     @Excel(name = "毛重")
@@ -200,12 +200,12 @@ public class ProductInventory extends BaseEntity
     {
         return boxNum;
     }
-    public void setSuttle(Long suttle) 
+    public void setSuttle(Double suttle)
     {
         this.suttle = suttle;
     }
 
-    public Long getSuttle() 
+    public Double getSuttle()
     {
         return suttle;
     }
@@ -227,12 +227,12 @@ public class ProductInventory extends BaseEntity
     {
         return warehouseId;
     }
-    public void setMachineTool(String machineTool) 
+    public void setMachineTool(Long machineTool)
     {
         this.machineTool = machineTool;
     }
 
-    public String getMachineTool() 
+    public Long getMachineTool()
     {
         return machineTool;
     }

+ 3 - 3
zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductOutboundRecord.java

@@ -59,7 +59,7 @@ public class ProductOutboundRecord extends BaseEntity
 
     /** 机台 */
     @Excel(name = "机台")
-    private String machineTool;
+    private Long machineTool;
 
     /** 毛重 */
     @Excel(name = "毛重")
@@ -227,12 +227,12 @@ public class ProductOutboundRecord extends BaseEntity
     {
         return productionDate;
     }
-    public void setMachineTool(String machineTool) 
+    public void setMachineTool(Long machineTool)
     {
         this.machineTool = machineTool;
     }
 
-    public String getMachineTool() 
+    public Long getMachineTool()
     {
         return machineTool;
     }

+ 3 - 3
zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductWarehousingRecord.java

@@ -59,7 +59,7 @@ public class ProductWarehousingRecord extends BaseEntity
 
     /** 机台 */
     @Excel(name = "机台")
-    private String machineTool;
+    private Long machineTool;
 
     /** 毛重 */
     @Excel(name = "毛重")
@@ -223,12 +223,12 @@ public class ProductWarehousingRecord extends BaseEntity
     {
         return productionDate;
     }
-    public void setMachineTool(String machineTool) 
+    public void setMachineTool(Long machineTool)
     {
         this.machineTool = machineTool;
     }
 
-    public String getMachineTool() 
+    public Long getMachineTool()
     {
         return machineTool;
     }

+ 0 - 1
zkqy-custom-business/src/main/java/com/zkqy/business/domain/SaleOrder.java

@@ -125,7 +125,6 @@ public class SaleOrder extends BaseEntity
 
 
     /** 批号 */
-    @Excel(name = "交货日期")
     private String lotNumber;
 
     //超级查询

+ 13 - 2
zkqy-custom-business/src/main/java/com/zkqy/business/domain/SaleProducts.java

@@ -93,12 +93,15 @@ public class SaleProducts extends BaseEntity
     @Excel(name = "色号")
     private String colourNumber;
 
+    /** 任务名称 */
+    private String taskName;
+
     /** 批号 */
     @Excel(name = "批号")
     private String lotNumber;
 
-    @Excel
-    private  String  onBoardState;
+    /** 上机状态 */
+    private String onBoardState;
 
 
     public String getOnBoardState() {
@@ -299,6 +302,14 @@ public class SaleProducts extends BaseEntity
         return colourNumber;
     }
 
+    public String getTaskName() {
+        return taskName;
+    }
+
+    public void setTaskName(String taskName) {
+        this.taskName = taskName;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 25 - 3
zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/ProductCodeListVO.java

@@ -51,7 +51,7 @@ public class ProductCodeListVO extends BaseEntity
     private Date productionDate;
 
     /** 机台 */
-    private String machineTool;
+    private Long machineTool;
 
     /** 毛重 */
     private Double grossWeight;
@@ -146,6 +146,12 @@ public class ProductCodeListVO extends BaseEntity
     /** 产品分类 */
     private String productType;
 
+    /** 客户名称 */
+    private String customName;
+
+    /** 机台号 */
+    private String machineToolNo;
+
     public Long getId() {
         return id;
     }
@@ -226,11 +232,11 @@ public class ProductCodeListVO extends BaseEntity
         this.productionDate = productionDate;
     }
 
-    public String getMachineTool() {
+    public Long getMachineTool() {
         return machineTool;
     }
 
-    public void setMachineTool(String machineTool) {
+    public void setMachineTool(Long machineTool) {
         this.machineTool = machineTool;
     }
 
@@ -496,6 +502,22 @@ public class ProductCodeListVO extends BaseEntity
         this.productType = productType;
     }
 
+    public String getCustomName() {
+        return customName;
+    }
+
+    public void setCustomName(String customName) {
+        this.customName = customName;
+    }
+
+    public String getMachineToolNo() {
+        return machineToolNo;
+    }
+
+    public void setMachineToolNo(String machineToolNo) {
+        this.machineToolNo = machineToolNo;
+    }
+
     @Override
     public String toString() {
         return "ProductCodeListVO{" +

+ 11 - 1
zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/ProductInvoiceVO.java

@@ -31,7 +31,7 @@ public class ProductInvoiceVO extends BaseEntity
     /** 销售员 */
     private String salesman;
 
-    /** 客户编号 */
+    /** 客户编号主键 */
     private Long customerId;
 
     /** 开票员 */
@@ -105,6 +105,8 @@ public class ProductInvoiceVO extends BaseEntity
     @Excel(name = "发货日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date deliveryDate;
 
+    /** 客户编号 */
+    private String customerNo;
 
     public void setId(Long id) 
     {
@@ -353,6 +355,14 @@ public class ProductInvoiceVO extends BaseEntity
         this.deliveryDate = deliveryDate;
     }
 
+    public String getCustomerNo() {
+        return customerNo;
+    }
+
+    public void setCustomerNo(String customerNo) {
+        this.customerNo = customerNo;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

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

@@ -99,6 +99,9 @@ public class SaleOrderVO {
     /** 客户名称 */
     private String customName;
 
+    /** 备注 */
+    private String remark;
+
     public Long getId() {
         return id;
     }
@@ -339,6 +342,16 @@ public class SaleOrderVO {
         this.customName = customName;
     }
 
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+
+
     @Override
     public String toString() {
         return "SaleOrderVO{" +

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

@@ -72,4 +72,9 @@ public interface CustomerMapper
      */
     Customer selectCustomerByCustomerNo(String customerNo);
 
+    /**
+     * 批量新增客户
+     */
+    int batchInsertCustomer(List<Customer> customerList);
+
 }

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

@@ -63,7 +63,7 @@ public interface ProductCodeListMapper
     /**
      * 查询生产完成的产品
      */
-    List<ProductCodeListVO> selectFinishedProduct();
+    List<ProductCodeListVO> selectFinishedProduct(ProductCodeList productCodeList);
 
     /**
      * 查询最大码单号

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

@@ -67,4 +67,11 @@ public interface ProductInvoiceMapper
      */
     ProductInvoice selectProductInvoiceBySaleOrderNo(String saleOrderNo);
 
+    /**
+     * 根据销售单号删除产品发货单
+     *
+     * @param saleOrderNo 销售单号
+     * @return 结果
+     */
+    int deleteProductInvoiceBySaleOrderNo(String saleOrderNo);
 }

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

@@ -84,4 +84,19 @@ public interface ProductOutboundRecordMapper
      * @return
      */
     ProductOutboundRecord statisticsBoxNumSuttle(@Param("productId") Long productId,@Param("noticeNumber") String noticeNumber,@Param("qrCode") String qrCode);
+
+    /**
+     * 根据通知单号查询出库明细
+     */
+    List<ProductCodeListVO> selectOutboundDetails(String noticeNumber);
+
+
+
+    /**
+     * 删除成品出库记录信息
+     *
+     * @param qrCodeId 成品出库记录主键
+     * @return 结果
+     */
+    public int deleteProductOutboundRecordByUUID(String qrCodeId);
 }

+ 7 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/mapper/ProductWarehousingRecordMapper.java

@@ -76,5 +76,12 @@ public interface ProductWarehousingRecordMapper
      */
     ProductWarehousingRecord selectProductWarehousingRecordWhetherExist(@Param("qrCode") String qrCode, @Param("qrCodeId") String qrCodeId);
 
+    /**
+     * 删除成品入库记录信息
+     *
+     * @param qrCodeId 成品出库记录主键
+     * @return 结果
+     */
+    public int deleteProductWarehousingRecordByUUID(String qrCodeId);
 
 }

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

@@ -46,6 +46,11 @@ public interface SaleOrderMapper
      */
     public int updateSaleOrder(SaleOrder saleOrder);
 
+    /**
+     * 根据销售单合同号修改销售订单
+     * @param saleOrder
+     * @return
+     */
     public int updateSaleOrderBySaleNo(SaleOrder saleOrder);
     /**
      * 批量修改销售订单

+ 12 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/mapper/SaleProductsMapper.java

@@ -1,6 +1,7 @@
 package com.zkqy.business.mapper;
 
 import java.util.List;
+import java.util.Set;
 
 import com.zkqy.business.domain.ProductInvoice;
 import com.zkqy.business.domain.SaleProducts;
@@ -119,4 +120,15 @@ public interface SaleProductsMapper
      */
     List<SaleProductsVo> selectOutboundOrderInfo(String saleOrderNo);
 
+    /**
+     * 批量新增
+     */
+    int batchInsertSaleProducts(List<SaleProducts> saleProducts);
+
+    /**
+     * 根据合同号查询销售产品编号
+     */
+    Set<Long> selectSaleProductsIdsBySaleNo(String saleNo);
+
+
 }

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

@@ -69,4 +69,9 @@ public interface ICustomerService
      */
     boolean checkCustomerNo(Long id,String customerNo);
 
+    /**
+     * 批量新增客户
+     */
+    int batchInsertCustomer(List<Customer> customerList);
+
 }

+ 18 - 9
zkqy-custom-business/src/main/java/com/zkqy/business/service/IProductCodeListInfoService.java

@@ -1,19 +1,20 @@
 package com.zkqy.business.service;
 
 import java.util.List;
+
 import com.zkqy.business.domain.ProductCodeListInfo;
+import com.zkqy.business.domain.vo.ProductCodeListVO;
 
 /**
  * 产品码单详情Service接口
- * 
+ *
  * @author zkqy
  * @date 2024-04-07
  */
-public interface IProductCodeListInfoService 
-{
+public interface IProductCodeListInfoService {
     /**
      * 查询产品码单详情
-     * 
+     *
      * @param id 产品码单详情主键
      * @return 产品码单详情
      */
@@ -21,7 +22,7 @@ public interface IProductCodeListInfoService
 
     /**
      * 查询产品码单详情列表
-     * 
+     *
      * @param productCodeListInfo 产品码单详情
      * @return 产品码单详情集合
      */
@@ -29,7 +30,7 @@ public interface IProductCodeListInfoService
 
     /**
      * 新增产品码单详情
-     * 
+     *
      * @param productCodeListInfoList 产品码单详情
      * @return 结果
      */
@@ -37,7 +38,7 @@ public interface IProductCodeListInfoService
 
     /**
      * 修改产品码单详情
-     * 
+     *
      * @param productCodeListInfo 产品码单详情
      * @return 结果
      */
@@ -45,7 +46,7 @@ public interface IProductCodeListInfoService
 
     /**
      * 批量删除产品码单详情
-     * 
+     *
      * @param ids 需要删除的产品码单详情主键集合
      * @return 结果
      */
@@ -53,9 +54,17 @@ public interface IProductCodeListInfoService
 
     /**
      * 删除产品码单详情信息
-     * 
+     *
      * @param id 产品码单详情主键
      * @return 结果
      */
     public int deleteProductCodeListInfoById(Long id);
+
+//    /**
+//     * 批量删除产品码单详情以及库存
+//     *
+//     * @param productCodeListVO 需要删除的产品码单详情信息
+//     * @return 结果
+//     */
+//    public int deleteProductCodeListInfoByInfo(ProductCodeListVO productCodeListVO);
 }

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

@@ -3,6 +3,7 @@ package com.zkqy.business.service;
 import java.util.List;
 import com.zkqy.business.domain.ProductCodeList;
 import com.zkqy.business.domain.vo.ProductCodeListVO;
+import com.zkqy.common.core.domain.AjaxResult;
 
 /**
  * 产品码单Service接口
@@ -63,7 +64,7 @@ public interface IProductCodeListService
     /**
      * 查询生产完成的产品
      */
-    List<ProductCodeListVO> selectFinishedProduct();
+    List<ProductCodeListVO> selectFinishedProduct(ProductCodeList productCodeList);
 
     /**
      * 码单号生成
@@ -80,4 +81,12 @@ public interface IProductCodeListService
      */
     ProductCodeListVO getProductCodeListById(Long id);
 
+    /**
+     * 批量删除产品码单详情以及库存
+     *
+     * @param productCodeListVO 需要删除的产品码单详情信息
+     * @return 结果
+     */
+    public AjaxResult deleteProductCodeListInfoByInfo(ProductCodeListVO productCodeListVO);
+
 }

+ 20 - 9
zkqy-custom-business/src/main/java/com/zkqy/business/service/IProductInventoryService.java

@@ -1,6 +1,8 @@
 package com.zkqy.business.service;
 
 import java.util.List;
+import java.util.Map;
+
 import com.zkqy.business.domain.ProductInventory;
 import com.zkqy.business.domain.ProductInvoice;
 import com.zkqy.business.domain.vo.ProductCodeListVO;
@@ -8,15 +10,14 @@ import com.zkqy.common.core.domain.AjaxResult;
 
 /**
  * 产品库存Service接口
- * 
+ *
  * @author zkqy
  * @date 2024-04-09
  */
-public interface IProductInventoryService 
-{
+public interface IProductInventoryService {
     /**
      * 查询产品库存
-     * 
+     *
      * @param id 产品库存主键
      * @return 产品库存
      */
@@ -24,7 +25,7 @@ public interface IProductInventoryService
 
     /**
      * 查询产品库存列表
-     * 
+     *
      * @param productInventory 产品库存
      * @return 产品库存集合
      */
@@ -32,7 +33,7 @@ public interface IProductInventoryService
 
     /**
      * 新增产品库存
-     * 
+     *
      * @param productInventory 产品库存
      * @return 结果
      */
@@ -40,7 +41,7 @@ public interface IProductInventoryService
 
     /**
      * 修改产品库存
-     * 
+     *
      * @param productInventory 产品库存
      * @return 结果
      */
@@ -48,7 +49,7 @@ public interface IProductInventoryService
 
     /**
      * 批量删除产品库存
-     * 
+     *
      * @param ids 需要删除的产品库存主键集合
      * @return 结果
      */
@@ -56,7 +57,7 @@ public interface IProductInventoryService
 
     /**
      * 删除产品库存信息
-     * 
+     *
      * @param id 产品库存主键
      * @return 结果
      */
@@ -74,8 +75,18 @@ public interface IProductInventoryService
 
     /**
      * 通知单出库
+     *
      * @param productInvoice
      * @return
      */
     AjaxResult noticeOutStorage(ProductInvoice productInvoice);
+
+
+    public AjaxResult deleteInventorByProductCodeListVO(ProductCodeListVO productCodeListVO);
+
+    /**
+     * 获取货品库存箱数重量/1:销售单;2:零售单
+     */
+    Map<String,Object> getProductInventory(ProductInventory productInventory);
+
 }

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

@@ -3,6 +3,7 @@ package com.zkqy.business.service;
 import java.util.List;
 import java.util.Map;
 
+import com.zkqy.business.domain.ProductInventory;
 import com.zkqy.business.domain.ProductInvoice;
 import com.zkqy.business.domain.vo.ProductInvoiceVO;
 
@@ -63,7 +64,7 @@ public interface IProductInvoiceService
     public int deleteProductInvoiceById(Long id);
 
     /**
-     * 查询发货单详情
+     * 查询发货单详情/销售单
      * @param saleOrderNo 销售单编号
      * @return
      */

+ 25 - 9
zkqy-custom-business/src/main/java/com/zkqy/business/service/IProductOutboundRecordService.java

@@ -1,20 +1,20 @@
 package com.zkqy.business.service;
 
 import java.util.List;
+
 import com.zkqy.business.domain.ProductOutboundRecord;
 import com.zkqy.business.domain.vo.ProductCodeListVO;
 
 /**
  * 成品出库记录Service接口
- * 
+ *
  * @author zkqy
  * @date 2024-04-09
  */
-public interface IProductOutboundRecordService 
-{
+public interface IProductOutboundRecordService {
     /**
      * 查询成品出库记录
-     * 
+     *
      * @param id 成品出库记录主键
      * @return 成品出库记录
      */
@@ -22,7 +22,7 @@ public interface IProductOutboundRecordService
 
     /**
      * 查询成品出库记录列表
-     * 
+     *
      * @param vo 成品出库记录
      * @return 成品出库记录集合
      */
@@ -30,7 +30,7 @@ public interface IProductOutboundRecordService
 
     /**
      * 新增成品出库记录
-     * 
+     *
      * @param productOutboundRecord 成品出库记录
      * @return 结果
      */
@@ -38,7 +38,7 @@ public interface IProductOutboundRecordService
 
     /**
      * 修改成品出库记录
-     * 
+     *
      * @param productOutboundRecord 成品出库记录
      * @return 结果
      */
@@ -46,7 +46,7 @@ public interface IProductOutboundRecordService
 
     /**
      * 批量删除成品出库记录
-     * 
+     *
      * @param ids 需要删除的成品出库记录主键集合
      * @return 结果
      */
@@ -54,7 +54,7 @@ public interface IProductOutboundRecordService
 
     /**
      * 删除成品出库记录信息
-     * 
+     *
      * @param id 成品出库记录主键
      * @return 结果
      */
@@ -62,9 +62,25 @@ public interface IProductOutboundRecordService
 
     /**
      * 查询是否已出库
+     *
      * @param qrCode
      * @param qrCodeId
      * @return
      */
     ProductOutboundRecord whetherStorage(String qrCode, String qrCodeId);
+
+    /**
+     * 查询销售单/零售单成品出库记录
+     * @param saleOrderNo
+     * @return
+     */
+    List<ProductCodeListVO> outboundDetails(String saleOrderNo);
+
+    /**
+     * 删除成品出库记录信息
+     *
+     * @param qrCodeId 成品出库记录主键
+     * @return 结果
+     */
+    public int deleteProductOutboundRecordByUUID(String qrCodeId);
 }

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

@@ -1,6 +1,8 @@
 package com.zkqy.business.service;
 
 import java.util.List;
+
+import com.zkqy.business.domain.ProductInvoice;
 import com.zkqy.business.domain.SaleOrder;
 import com.zkqy.business.domain.vo.SaleOrderVO;
 
@@ -73,12 +75,37 @@ public interface ISaleOrderService
     int batchApproval(SaleOrderVO vo);
 
     /**
-     * 销售单列表--权限过滤
+     * 销售单/零售单列表--权限过滤
      * @param saleOrder
      * @return
      */
     List<SaleOrderVO> saleOrderList(SaleOrder saleOrder);
 
+    /**
+     * 新增零售单
+     */
+    int addRetailOrder(SaleOrderVO vo);
+
+    /**
+     * 查询零售单详情
+     * @param id
+     * @return
+     */
+    SaleOrderVO getRetailOrderInfo(Long id);
 
+    /**
+     * 修改零售单
+     */
+    int editRetailOrder(SaleOrderVO vo);
+
+    /**
+     * 零售单提交
+     */
+    int submitRetailOrder(ProductInvoice productInvoice);
+
+    /**
+     * 零售单撤销
+     */
+    int cancelRetailOrder(ProductInvoice productInvoice);
 
 }

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

@@ -146,4 +146,9 @@ public class CustomerServiceImpl implements ICustomerService
             }
         }
     }
+
+    @Override
+    public int batchInsertCustomer(List<Customer> customerList) {
+        return customerMapper.batchInsertCustomer(customerList);
+    }
 }

+ 28 - 21
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductCodeListInfoServiceImpl.java

@@ -1,6 +1,9 @@
 package com.zkqy.business.service.impl;
 
 import java.util.List;
+
+import com.zkqy.business.domain.vo.ProductCodeListVO;
+import com.zkqy.business.service.IProductInventoryService;
 import com.zkqy.common.utils.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -10,87 +13,91 @@ import com.zkqy.business.service.IProductCodeListInfoService;
 
 /**
  * 产品码单详情Service业务层处理
- * 
+ *
  * @author zkqy
  * @date 2024-04-07
  */
 @Service
-public class ProductCodeListInfoServiceImpl implements IProductCodeListInfoService 
-{
+public class ProductCodeListInfoServiceImpl implements IProductCodeListInfoService {
     @Autowired
     private ProductCodeListInfoMapper productCodeListInfoMapper;
 
+    @Autowired
+    private IProductInventoryService iProductInventoryService;
+
     /**
      * 查询产品码单详情
-     * 
+     *
      * @param id 产品码单详情主键
      * @return 产品码单详情
      */
     @Override
-    public ProductCodeListInfo selectProductCodeListInfoById(Long id)
-    {
+    public ProductCodeListInfo selectProductCodeListInfoById(Long id) {
         return productCodeListInfoMapper.selectProductCodeListInfoById(id);
     }
 
     /**
      * 查询产品码单详情列表
-     * 
+     *
      * @param productCodeListInfo 产品码单详情
      * @return 产品码单详情
      */
     @Override
-    public List<ProductCodeListInfo> selectProductCodeListInfoList(ProductCodeListInfo productCodeListInfo)
-    {
+    public List<ProductCodeListInfo> selectProductCodeListInfoList(ProductCodeListInfo productCodeListInfo) {
         return productCodeListInfoMapper.selectProductCodeListInfoList(productCodeListInfo);
     }
 
     /**
      * 新增产品码单详情
-     * 
+     *
      * @param productCodeListInfoList 产品码单详情
      * @return 结果
      */
     @Override
-    public int insertProductCodeListInfo(List<ProductCodeListInfo> productCodeListInfoList)
-    {
+    public int insertProductCodeListInfo(List<ProductCodeListInfo> productCodeListInfoList) {
 //        productCodeListInfo.setCreateTime(DateUtils.getNowDate());
         return productCodeListInfoMapper.insertProductCodeListInfo(productCodeListInfoList);
     }
 
     /**
      * 修改产品码单详情
-     * 
+     *
      * @param productCodeListInfo 产品码单详情
      * @return 结果
      */
     @Override
-    public int updateProductCodeListInfo(ProductCodeListInfo productCodeListInfo)
-    {
+    public int updateProductCodeListInfo(ProductCodeListInfo productCodeListInfo) {
         productCodeListInfo.setUpdateTime(DateUtils.getNowDate());
         return productCodeListInfoMapper.updateProductCodeListInfo(productCodeListInfo);
     }
 
     /**
      * 批量删除产品码单详情
-     * 
+     *
      * @param ids 需要删除的产品码单详情主键
      * @return 结果
      */
     @Override
-    public int deleteProductCodeListInfoByIds(List<Long> ids)
-    {
+    public int deleteProductCodeListInfoByIds(List<Long> ids) {
         return productCodeListInfoMapper.deleteProductCodeListInfoByIds(ids);
     }
 
     /**
      * 删除产品码单详情信息
-     * 
+     *
      * @param id 产品码单详情主键
      * @return 结果
      */
     @Override
-    public int deleteProductCodeListInfoById(Long id)
-    {
+    public int deleteProductCodeListInfoById(Long id) {
         return productCodeListInfoMapper.deleteProductCodeListInfoById(id);
     }
+
+//    @Override
+//    public int deleteProductCodeListInfoByInfo(ProductCodeListVO productCodeListVO) {
+//        productCodeListInfoMapper.deleteProductCodeListInfoById(productCodeListVO.getId());// 删除码单
+//        // 删除库存
+//        return iProductInventoryService.deleteInventorByProductCodeListVO(productCodeListVO);
+//
+//    }
 }

+ 65 - 61
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductCodeListServiceImpl.java

@@ -3,16 +3,20 @@ package com.zkqy.business.service.impl;
 import java.text.DecimalFormat;
 import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
 import java.util.List;
 
 import com.zkqy.business.domain.ProductWarehousingRecord;
 import com.zkqy.business.domain.vo.ProductCodeListVO;
 import com.zkqy.business.mapper.ProductCodeListInfoMapper;
 import com.zkqy.business.mapper.ProductWarehousingRecordMapper;
+import com.zkqy.business.service.IProductInventoryService;
 import com.zkqy.common.core.domain.AjaxResult;
+import com.zkqy.common.core.domain.entity.SysDictData;
 import com.zkqy.common.utils.DateUtils;
 import com.zkqy.common.utils.SecurityUtils;
 import com.zkqy.common.utils.StringUtils;
+import com.zkqy.system.mapper.SysDictDataMapper;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -23,13 +27,12 @@ import org.springframework.transaction.annotation.Transactional;
 
 /**
  * 产品码单Service业务层处理
- * 
+ *
  * @author zkqy
  * @date 2024-04-01
  */
 @Service
-public class ProductCodeListServiceImpl implements IProductCodeListService 
-{
+public class ProductCodeListServiceImpl implements IProductCodeListService {
     @Autowired
     private ProductCodeListMapper productCodeListMapper;
 
@@ -39,19 +42,24 @@ public class ProductCodeListServiceImpl implements IProductCodeListService
     @Autowired
     private ProductWarehousingRecordMapper productWarehousingRecordMapper;
 
+    @Autowired
+    private SysDictDataMapper dictDataMapper;
+
+    @Autowired
+    private IProductInventoryService iProductInventoryService;
+
 
     /**
      * 查询产品码单
-     * 
+     *
      * @param id 产品码单主键
      * @return 产品码单
      */
     @Override
-    public ProductCodeListVO selectProductCodeListById(Long id)
-    {
+    public ProductCodeListVO selectProductCodeListById(Long id) {
         ProductCodeList productCodeList = productCodeListMapper.selectProductCodeListById(id);
         ProductCodeListVO productCodeListVO = new ProductCodeListVO();
-        BeanUtils.copyProperties(productCodeList,productCodeListVO);
+        BeanUtils.copyProperties(productCodeList, productCodeListVO);
 //        ProductCodeListInfo productCodeListInfo = new ProductCodeListInfo();
 //        productCodeListInfo.setCodeListId(id);
 //        List<ProductCodeListInfo> productCodeListInfoList = productCodeListInfoMapper.selectProductCodeListInfoList(productCodeListInfo);
@@ -61,87 +69,74 @@ public class ProductCodeListServiceImpl implements IProductCodeListService
 
     /**
      * 查询产品码单列表
-     * 
+     *
      * @param vo 产品码单
      * @return 产品码单
      */
     @Override
-    public List<ProductCodeListVO> selectProductCodeListList(ProductCodeListVO vo)
-    {
+    public List<ProductCodeListVO> selectProductCodeListList(ProductCodeListVO vo) {
         List<ProductCodeListVO> productCodeListVOS = productCodeListMapper.selectProductCodeListList(vo);
-        for (ProductCodeListVO vo1 : productCodeListVOS){
+        for (ProductCodeListVO vo1 : productCodeListVOS) {
             vo1.setTotalSuttle(handlingWeight(vo1.getTotalSuttle()));
         }
         return productCodeListVOS;
     }
 
-    public Double handlingWeight(Double weight){
+    public Double handlingWeight(Double weight) {
         DecimalFormat df = new DecimalFormat("0.00");
         return Double.parseDouble(df.format(weight));
     }
 
     /**
      * 新增产品码单
-     * 
+     *
      * @param vo 产品码单
      * @return 结果
      */
     @Override
     @Transactional
-    public Long insertProductCodeList(ProductCodeListVO vo)
-    {
-        System.err.println(vo.getId());
-//        if(vo.getId() == null){
-            //新增产品码单数据
-            ProductCodeList productCodeList = new ProductCodeList();
-            BeanUtils.copyProperties(vo,productCodeList);
-            productCodeList.setCreateTime(DateUtils.getNowDate());
-            productCodeList.setCreateBy(SecurityUtils.getUsername());
-            productCodeList.setCreateById(SecurityUtils.getUserId());
-//            productCodeList.setTotalBoxNum(1);
-//            productCodeList.setTotalCanisterNum(vo.getCanisterNum());
-//            productCodeList.setTotalSuttle(vo.getSuttle());
-//            productCodeList.setTotalGrossWeight(vo.getGrossWeight());
-            productCodeListMapper.insertProductCodeList(productCodeList);
-            return productCodeList.getId();
-//        }else {
-//            //计算合计箱数、筒数、净重、毛重
-//            ProductCodeList productCodeList = productCodeListMapper.selectProductCodeListById(vo.getId());
-//            ProductCodeList editProductCodeList = new ProductCodeList();
-//            editProductCodeList.setId(productCodeList.getId());
-//
-//            editProductCodeList.setTotalBoxNum(productCodeList.getTotalBoxNum() == null ? 1 : productCodeList.getTotalBoxNum() + 1);//箱数
-//            editProductCodeList.setTotalCanisterNum(productCodeList.getTotalCanisterNum() == null ? vo.getCanisterNum() : productCodeList.getTotalCanisterNum() + vo.getCanisterNum());//筒数
-//            Double suttle = productCodeList.getTotalSuttle() == null ? vo.getSuttle() : productCodeList.getTotalSuttle() + vo.getSuttle();
-//            DecimalFormat df = new DecimalFormat("0.00");
-//            String suttle1 = df.format(suttle);
-//            editProductCodeList.setTotalSuttle(Double.parseDouble(suttle1));//净重
-//            Double grossWeight = productCodeList.getTotalGrossWeight() == null ? vo.getGrossWeight() : productCodeList.getTotalGrossWeight() + vo.getGrossWeight();
-//            String grossWeight1 = df.format(grossWeight);
-//            editProductCodeList.setTotalGrossWeight(Double.parseDouble(grossWeight1));//毛重
-//            productCodeListMapper.updateProductCodeList(editProductCodeList);
-//
-//            return vo.getId();
-//        }
+    public Long insertProductCodeList(ProductCodeListVO vo) {
+        //新增产品码单数据
+        ProductCodeList productCodeList = new ProductCodeList();
+        BeanUtils.copyProperties(vo, productCodeList);
+        productCodeList.setCreateTime(DateUtils.getNowDate());
+        productCodeList.setCreateBy(SecurityUtils.getUsername());
+        productCodeList.setCreateById(SecurityUtils.getUserId());
+        productCodeListMapper.insertProductCodeList(productCodeList);
+        // 直接入库--
+        vo.getMachineTool();  // 当前机台
+
+        String bumen = vo.getMachineToolNo().split("-")[0];
+        List<SysDictData> dictDataList = dictDataMapper.selectDictDataByType("section_stash");
+        dictDataList.forEach(item -> {
+            if (item.getDictLabel().equals(bumen)) {
+                vo.setWarehouseId(Long.valueOf(item.getDictValue()));// 入库仓库ID
+            }
+        });
+        List<ProductCodeListVO> productCodeListVOList = new ArrayList<>();
+        productCodeListVOList.add(vo);
+
+
+        iProductInventoryService.productStorage(productCodeListVOList);
+        return productCodeList.getId();
     }
 
     /**
      * 修改产品码单
-     * 
+     *
      * @param vo 产品码单
      * @return 结果
      */
     @Override
     @Transactional
-    public int updateProductCodeList(ProductCodeListVO vo)
-    {
+    public int updateProductCodeList(ProductCodeListVO vo) {
 
         // 修改产品码单数据
         ProductCodeList productCodeList = new ProductCodeList();
         productCodeList.setUpdateTime(DateUtils.getNowDate());
         productCodeList.setUpdateById(SecurityUtils.getUserId());
         productCodeList.setUpdateBy(SecurityUtils.getUsername());
-        BeanUtils.copyProperties(vo,productCodeList);
+        BeanUtils.copyProperties(vo, productCodeList);
         // 修改产品码单详情
 //        LinkedList<ProductCodeListInfo> addProductCodeListInfoList = new LinkedList<>();
 //        LinkedList<ProductCodeListInfo> editProductCodeListInfoList = new LinkedList<>();
@@ -184,40 +179,40 @@ public class ProductCodeListServiceImpl implements IProductCodeListService
 
     /**
      * 批量删除产品码单
-     * 
+     *
      * @param ids 需要删除的产品码单主键
      * @return 结果
      */
     @Override
-    public int deleteProductCodeListByIds(String[] ids)
-    {
+    public int deleteProductCodeListByIds(String[] ids) {
         return productCodeListMapper.deleteProductCodeListByIds(ids);
     }
 
     /**
      * 删除产品码单信息
-     * 
+     *
      * @param id 产品码单主键
      * @return 结果
      */
     @Override
-    public int deleteProductCodeListById(Long id)
-    {
+    public int deleteProductCodeListById(Long id) {
         return productCodeListMapper.deleteProductCodeListById(id);
     }
 
     @Override
-    public List<ProductCodeListVO> selectFinishedProduct() {
-        return productCodeListMapper.selectFinishedProduct();
+    public List<ProductCodeListVO> selectFinishedProduct(ProductCodeList productCodeList) {
+        return productCodeListMapper.selectFinishedProduct(productCodeList);
     }
 
+
+
     @Override
     public String selectMaxCodeList() {
         String maxCodeList = productCodeListMapper.selectMaxCodeList();
         LocalDate now = LocalDate.now();
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyMMdd");
         String nowCodeList = now.format(formatter) + "00001";
-        if(StringUtils.isNotEmpty(maxCodeList) && Long.parseLong(maxCodeList) >= Long.parseLong(nowCodeList)){
+        if (StringUtils.isNotEmpty(maxCodeList) && Long.parseLong(maxCodeList) >= Long.parseLong(nowCodeList)) {
             return Long.parseLong(maxCodeList) + 1L + "";
         }
         return nowCodeList;
@@ -233,4 +228,13 @@ public class ProductCodeListServiceImpl implements IProductCodeListService
         return productCodeListMapper.getProductCodeListById(id);
     }
 
+    @Override
+    public AjaxResult deleteProductCodeListInfoByInfo(ProductCodeListVO productCodeListVO) {
+//        productCodeListInfoMapper.deleteProductCodeListInfoById(productCodeListVO.getId());// 删除码单
+        productCodeListMapper.deleteProductCodeListById(productCodeListVO.getId());
+
+        // 删除库存
+        return iProductInventoryService.deleteInventorByProductCodeListVO(productCodeListVO);
+    }
+
 }

+ 109 - 56
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductInventoryServiceImpl.java

@@ -1,7 +1,9 @@
 package com.zkqy.business.service.impl;
 
 import java.text.DecimalFormat;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import com.zkqy.business.domain.*;
 import com.zkqy.business.domain.vo.ProductCodeListVO;
@@ -17,13 +19,12 @@ import org.springframework.transaction.annotation.Transactional;
 
 /**
  * 产品库存Service业务层处理
- * 
+ *
  * @author zkqy
  * @date 2024-04-09
  */
 @Service
-public class ProductInventoryServiceImpl implements IProductInventoryService 
-{
+public class ProductInventoryServiceImpl implements IProductInventoryService {
     @Autowired
     private ProductInventoryMapper productInventoryMapper;
 
@@ -45,75 +46,69 @@ public class ProductInventoryServiceImpl implements IProductInventoryService
 
     /**
      * 查询产品库存
-     * 
+     *
      * @param id 产品库存主键
      * @return 产品库存
      */
     @Override
-    public ProductInventory selectProductInventoryById(Long id)
-    {
+    public ProductInventory selectProductInventoryById(Long id) {
         return productInventoryMapper.selectProductInventoryById(id);
     }
 
     /**
      * 查询产品库存列表
-     * 
+     *
      * @param productInventory 产品库存
      * @return 产品库存
      */
     @Override
-    public List<ProductInventory> selectProductInventoryList(ProductInventory productInventory)
-    {
+    public List<ProductInventory> selectProductInventoryList(ProductInventory productInventory) {
         return productInventoryMapper.selectProductInventoryList(productInventory);
     }
 
     /**
      * 新增产品库存
-     * 
+     *
      * @param productInventory 产品库存
      * @return 结果
      */
     @Override
-    public int insertProductInventory(ProductInventory productInventory)
-    {
+    public int insertProductInventory(ProductInventory productInventory) {
         productInventory.setCreateTime(DateUtils.getNowDate());
         return productInventoryMapper.insertProductInventory(productInventory);
     }
 
     /**
      * 修改产品库存
-     * 
+     *
      * @param productInventory 产品库存
      * @return 结果
      */
     @Override
-    public int updateProductInventory(ProductInventory productInventory)
-    {
+    public int updateProductInventory(ProductInventory productInventory) {
         productInventory.setUpdateTime(DateUtils.getNowDate());
         return productInventoryMapper.updateProductInventory(productInventory);
     }
 
     /**
      * 批量删除产品库存
-     * 
+     *
      * @param ids 需要删除的产品库存主键
      * @return 结果
      */
     @Override
-    public int deleteProductInventoryByIds(Long[] ids)
-    {
+    public int deleteProductInventoryByIds(Long[] ids) {
         return productInventoryMapper.deleteProductInventoryByIds(ids);
     }
 
     /**
      * 删除产品库存信息
-     * 
+     *
      * @param id 产品库存主键
      * @return 结果
      */
     @Override
-    public int deleteProductInventoryById(Long id)
-    {
+    public int deleteProductInventoryById(Long id) {
         return productInventoryMapper.deleteProductInventoryById(id);
     }
 
@@ -121,17 +116,17 @@ public class ProductInventoryServiceImpl implements IProductInventoryService
     @Transactional
     public void productStorage(List<ProductCodeListVO> productCodeListVOList) {
 
-        for (ProductCodeListVO vo : productCodeListVOList){
+        for (ProductCodeListVO vo : productCodeListVOList) {
             // 日志
-            ProductCodeList productCodeList = productCodeListMapper.selectProductCodeListById(vo.getId());
+            ProductCodeList productCodeList = new ProductCodeList(vo);
             //校验当前货品是否已入库,已入库跳过本次循环
             ProductWarehousingRecord productWarehousingRecord1 =
                     productWarehousingRecordMapper.selectProductWarehousingRecordWhetherExist(productCodeList.getQrCode(), vo.getQrCodeId());
-            if(productWarehousingRecord1 != null){
+            if (productWarehousingRecord1 != null) {
                 continue;
             }
             ProductWarehousingRecord productWarehousingRecord = new ProductWarehousingRecord();
-            BeanUtils.copyProperties(productCodeList,productWarehousingRecord);
+            BeanUtils.copyProperties(productCodeList, productWarehousingRecord);
             productWarehousingRecord.setQrCodeId(vo.getQrCodeId());
             productWarehousingRecord.setCanisterNum(vo.getCanisterNum());//筒数
             productWarehousingRecord.setSuttle(vo.getSuttle());//净重
@@ -139,20 +134,20 @@ public class ProductInventoryServiceImpl implements IProductInventoryService
             productWarehousingRecord.setCreateBy(SecurityUtils.getUsername());
             productWarehousingRecord.setCreateTime(DateUtils.getNowDate());
             productWarehousingRecord.setCreateById(SecurityUtils.getUserId());
-            productWarehousingRecord.setDepositor(vo.getDepositor());
-            productWarehousingRecord.setWarehousingTime(vo.getWarehousingTime());
-            productWarehousingRecord.setWarehouseId(vo.getWarehouseId());
+            productWarehousingRecord.setDepositor(SecurityUtils.getLoginUser().getUser().getNickName());//入库人
+            productWarehousingRecord.setWarehousingTime(DateUtils.getNowDate());
+            productWarehousingRecord.setWarehouseId(vo.getWarehouseId());//入库仓库编号
             productWarehousingRecord.setRemark(productCodeList.getRemark());
             productWarehousingRecordMapper.insertProductWarehousingRecord(productWarehousingRecord);
 
             // 库存
             //查询当前库存是否存在,如果存在则更新,如果不存在则新增
             ProductInventory productInventory = productInventoryMapper.selectProductInventoryByQrCode(vo.getQrCode());
-            if(productInventory != null){
+            if (productInventory != null) {
                 //计算合计箱数、筒数、净重、毛重
                 ProductInventory editProductInventory = new ProductInventory();
                 editProductInventory.setId(productInventory.getId());
-                editProductInventory.setTotalCanisterNum( productInventory.getTotalCanisterNum() == null ? vo.getCanisterNum() : productInventory.getTotalCanisterNum() + vo.getCanisterNum());//合计筒数数
+                editProductInventory.setTotalCanisterNum(productInventory.getTotalCanisterNum() == null ? vo.getCanisterNum() : productInventory.getTotalCanisterNum() + vo.getCanisterNum());//合计筒数数
                 editProductInventory.setTotalBoxNum(productInventory.getTotalBoxNum() + 1);//合计箱数
                 Double suttle = productInventory.getTotalSuttle() == null ? vo.getSuttle() : productInventory.getTotalSuttle() + vo.getSuttle();
                 DecimalFormat df = new DecimalFormat("0.00");
@@ -162,16 +157,21 @@ public class ProductInventoryServiceImpl implements IProductInventoryService
                 Double grossWeight = productInventory.getTotalGrossWeight() == null ? vo.getGrossWeight() : productInventory.getTotalGrossWeight() + vo.getGrossWeight();
                 String grossWeight1 = df.format(grossWeight);
                 editProductInventory.setTotalGrossWeight(Double.parseDouble(grossWeight1));//合计毛重
+                editProductInventory.setUpdateById(SecurityUtils.getUserId());
+                editProductInventory.setUpdateBy(SecurityUtils.getUsername());
+                editProductInventory.setUpdateTime(DateUtils.getNowDate());
                 productInventoryMapper.updateProductInventory(editProductInventory);
-            }else {
+            } else {
                 ProductInventory addProductInventory = new ProductInventory();
-                BeanUtils.copyProperties(productCodeList,addProductInventory);
+                BeanUtils.copyProperties(productCodeList, addProductInventory);
                 addProductInventory.setWarehouseId(vo.getWarehouseId());
                 addProductInventory.setTotalCanisterNum(vo.getCanisterNum());//合计筒数
                 addProductInventory.setTotalBoxNum(1);//合计箱数
                 addProductInventory.setTotalSuttle(vo.getSuttle());//合计净重
                 addProductInventory.setTotalGrossWeight(vo.getGrossWeight());//合计毛重
-
+                addProductInventory.setCreateBy(SecurityUtils.getUsername());
+                addProductInventory.setCreateTime(DateUtils.getNowDate());
+                addProductInventory.setCreateById(SecurityUtils.getUserId());
                 productInventoryMapper.insertProductInventory(addProductInventory);
             }
 
@@ -183,18 +183,18 @@ public class ProductInventoryServiceImpl implements IProductInventoryService
     @Transactional
     public AjaxResult productOutStorage(List<ProductCodeListVO> productCodeListVOList) {
 
-        for (ProductCodeListVO vo : productCodeListVOList){
+        for (ProductCodeListVO vo : productCodeListVOList) {
 
             // 出库日志
             ProductCodeList productCodeList = productCodeListMapper.selectProductCodeListById(vo.getId());
 
             // 校验当前货品是否已出库,已出库跳过本次循环
             ProductOutboundRecord productOutboundRecord1 = productOutboundRecordMapper.selectProductOutboundRecordWhetherExist(vo.getQrCode(), vo.getQrCodeId());
-            if(productOutboundRecord1 != null){
+            if (productOutboundRecord1 != null) {
                 continue;
             }
             ProductOutboundRecord productOutboundRecord = new ProductOutboundRecord();
-            BeanUtils.copyProperties(productCodeList,productOutboundRecord);
+            BeanUtils.copyProperties(productCodeList, productOutboundRecord);
             //二维码唯一标识
             productOutboundRecord.setQrCodeId(vo.getQrCodeId());
             productOutboundRecord.setCanisterNum(vo.getCanisterNum());//筒数
@@ -213,27 +213,27 @@ public class ProductInventoryServiceImpl implements IProductInventoryService
             ProductInventory editProductInventory = new ProductInventory();
             editProductInventory.setId(productInventory.getId());
             //筒数
-            if(productInventory.getTotalCanisterNum() - vo.getCanisterNum() < 0){
+            if (productInventory.getTotalCanisterNum() - vo.getCanisterNum() < 0) {
                 return AjaxResult.error("当前库存筒数不足");
-            }else {
+            } else {
                 editProductInventory.setTotalCanisterNum(productInventory.getTotalCanisterNum() - vo.getCanisterNum());
             }
             //箱数
-            if(productInventory.getTotalBoxNum() - 1 < 0){
+            if (productInventory.getTotalBoxNum() - 1 < 0) {
                 return AjaxResult.error("当前库存箱数不足");
-            }else {
+            } else {
                 editProductInventory.setTotalBoxNum(productInventory.getTotalBoxNum() - 1);
             }
             //净重
-            if(productInventory.getTotalSuttle() - vo.getSuttle() < 0){
+            if (productInventory.getTotalSuttle() - vo.getSuttle() < 0) {
                 return AjaxResult.error("当前库存净重不足");
-            }else {
+            } else {
                 editProductInventory.setTotalSuttle(handlingWeight(productInventory.getTotalSuttle() - vo.getSuttle()));
             }
             //毛重
-            if (productInventory.getTotalGrossWeight() - vo.getGrossWeight() < 0){
+            if (productInventory.getTotalGrossWeight() - vo.getGrossWeight() < 0) {
                 return AjaxResult.error("当前库存毛重不足");
-            }else {
+            } else {
                 editProductInventory.setTotalGrossWeight(handlingWeight(productInventory.getTotalGrossWeight() - vo.getGrossWeight()));
             }
             productInventoryMapper.updateProductInventory(editProductInventory);
@@ -262,10 +262,10 @@ public class ProductInventoryServiceImpl implements IProductInventoryService
         List<ProductHandsetOutboundRecord> productHandsetOutboundRecords =
                 productHandsetOutboundRecordMapper.selectProductHandsetOutboundRecordList(productHandsetOutboundRecord);
         // 循环插入出库记录
-        for (ProductHandsetOutboundRecord productHandsetOutboundRecord1 : productHandsetOutboundRecords){
+        for (ProductHandsetOutboundRecord productHandsetOutboundRecord1 : productHandsetOutboundRecords) {
 
             ProductOutboundRecord productOutboundRecord = new ProductOutboundRecord();
-            BeanUtils.copyProperties(productHandsetOutboundRecord1,productOutboundRecord);
+            BeanUtils.copyProperties(productHandsetOutboundRecord1, productOutboundRecord);
             productOutboundRecord.setWarehousingTime(productInvoice.getDeliveryDate());
             productOutboundRecord.setDepositor(productInvoice.getDeliveryClerk());
             productOutboundRecordMapper.insertProductOutboundRecord(productOutboundRecord);
@@ -275,27 +275,27 @@ public class ProductInventoryServiceImpl implements IProductInventoryService
             ProductInventory editProductInventory = new ProductInventory();
             editProductInventory.setId(productInventory.getId());
             //筒数
-            if(productInventory.getTotalCanisterNum() - productHandsetOutboundRecord1.getCanisterNum() < 0){
+            if (productInventory.getTotalCanisterNum() - productHandsetOutboundRecord1.getCanisterNum() < 0) {
                 return AjaxResult.error("当前库存筒数不足");
-            }else {
+            } else {
                 editProductInventory.setTotalCanisterNum(productInventory.getTotalCanisterNum() - productHandsetOutboundRecord1.getCanisterNum());
             }
             //箱数
-            if(productInventory.getTotalBoxNum() - 1 < 0){
+            if (productInventory.getTotalBoxNum() - 1 < 0) {
                 return AjaxResult.error("当前库存箱数不足");
-            }else {
+            } else {
                 editProductInventory.setTotalBoxNum(productInventory.getTotalBoxNum() - 1);
             }
             //净重
-            if(productInventory.getTotalSuttle() - productHandsetOutboundRecord1.getSuttle() < 0){
+            if (productInventory.getTotalSuttle() - productHandsetOutboundRecord1.getSuttle() < 0) {
                 return AjaxResult.error("当前库存净重不足");
-            }else {
+            } else {
                 editProductInventory.setTotalSuttle(handlingWeight(productInventory.getTotalSuttle() - productHandsetOutboundRecord1.getSuttle()));
             }
             //毛重
-            if (productInventory.getTotalGrossWeight() - productHandsetOutboundRecord1.getGrossWeight() < 0){
+            if (productInventory.getTotalGrossWeight() - productHandsetOutboundRecord1.getGrossWeight() < 0) {
                 return AjaxResult.error("当前库存毛重不足");
-            }else {
+            } else {
                 editProductInventory.setTotalGrossWeight(handlingWeight(productInventory.getTotalGrossWeight() - productHandsetOutboundRecord1.getGrossWeight()));
             }
             productInventoryMapper.updateProductInventory(editProductInventory);
@@ -304,10 +304,63 @@ public class ProductInventoryServiceImpl implements IProductInventoryService
         return AjaxResult.success();
     }
 
+    @Override
+    public AjaxResult deleteInventorByProductCodeListVO(ProductCodeListVO productCodeListVO) {
+        //出库   减 箱数、筒数、净重、毛重,
+        //得到当前库存
+        ProductInventory productInventory = productInventoryMapper.selectProductInventoryByQrCode(productCodeListVO.getQrCode());
+        ProductInventory editProductInventory = new ProductInventory();
+        editProductInventory.setId(productInventory.getId());
+        //筒数
+        if (productInventory.getTotalCanisterNum() - productCodeListVO.getCanisterNum() < 0) {
+            return AjaxResult.error("当前库存筒数不足");
+        } else {
+            editProductInventory.setTotalCanisterNum(productInventory.getTotalCanisterNum() - productCodeListVO.getCanisterNum());
+        }
+        //箱数
+        if (productInventory.getTotalBoxNum() - 1 < 0) {
+            return AjaxResult.error("当前库存箱数不足");
+        } else {
+            editProductInventory.setTotalBoxNum(productInventory.getTotalBoxNum() - 1);
+        }
+        //净重
+        if (productInventory.getTotalSuttle() - productCodeListVO.getSuttle() < 0) {
+            return AjaxResult.error("当前库存净重不足");
+        } else {
+            editProductInventory.setTotalSuttle(handlingWeight(productInventory.getTotalSuttle() - productCodeListVO.getSuttle()));
+        }
+        //毛重
+        if (productInventory.getTotalGrossWeight() - productCodeListVO.getGrossWeight() < 0) {
+            return AjaxResult.error("当前库存毛重不足");
+        } else {
+            editProductInventory.setTotalGrossWeight(handlingWeight(productInventory.getTotalGrossWeight() - productCodeListVO.getGrossWeight()));
+        }
+        // 删除入库记录
+//        productOutboundRecordMapper.deleteProductOutboundRecordByUUID(productCodeListVO.getQrCodeId());
+        productWarehousingRecordMapper.deleteProductWarehousingRecordByUUID(productCodeListVO.getQrCodeId());
+
+        return AjaxResult.success(productInventoryMapper.updateProductInventory(editProductInventory));
+    }
+
+    @Override
+    public Map<String,Object> getProductInventory(ProductInventory productInventory) {
+        Map<String,Object> map = new HashMap<>();
+
+        ProductInventory productInventory1 = productInventoryMapper.selectProductInventoryByLotNumAndProductId(productInventory);
+        if(productInventory1 != null && productInventory1.getTotalSuttle() > 0){
+            productInventory1.setTotalSuttle(handlingWeight(productInventory1.getTotalSuttle()));
+            map.put("inventoryBoxNum", productInventory1.getTotalBoxNum());
+            map.put("inventoryWeight", handlingWeight(productInventory1.getTotalSuttle()));
+        }else {
+            map.put("inventoryBoxNum", 0);
+            map.put("inventoryWeight", 0);
+        }
+        return map;
+    }
+
     //保留两位小数
-    public Double handlingWeight(Double weight){
+    public Double handlingWeight(Double weight) {
         DecimalFormat df = new DecimalFormat("0.00");
         return Double.parseDouble(df.format(weight));
     }
-
 }

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

@@ -127,6 +127,9 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService
         ProductInvoice productInvoice = productInvoiceMapper.selectProductInvoiceBySaleOrderNo(saleOrderNo);
         if(productInvoice != null){
             BeanUtils.copyProperties(productInvoice, vo);
+        }else {
+            SaleOrder saleOrder = saleOrderMapper.selectSaleOrderBySaleNo(saleOrderNo);
+            vo.setCustomerNo(saleOrder.getSaleCustomNo());
         }
         //表格数据
         //根据销售单编号查询货品信息
@@ -175,8 +178,12 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService
         //查询发货通知单详情
         ProductInvoice productInvoice = productInvoiceMapper.selectProductInvoiceById(id);
         BeanUtils.copyProperties(productInvoice, vo);
+
+
         //查询发货单货品详情,循环得到货品实发箱数、重量
         List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList = saleProductsMapper.selectSaleProductsInfo(productInvoice.getSaleOrderNo());
+
+
         for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList){
             //实发箱数、重量
             ProductHandsetOutboundRecord productHandsetOutboundRecord =
@@ -193,7 +200,6 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService
         return vo;
     }
 
-
     //保留两位小数
     public Double handlingWeight(Double weight){
         DecimalFormat df = new DecimalFormat("0.00");

+ 36 - 22
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductOutboundRecordServiceImpl.java

@@ -1,8 +1,11 @@
 package com.zkqy.business.service.impl;
 
+import java.util.ArrayList;
 import java.util.List;
 
+import com.zkqy.business.domain.ProductInvoice;
 import com.zkqy.business.domain.vo.ProductCodeListVO;
+import com.zkqy.business.mapper.ProductInvoiceMapper;
 import com.zkqy.common.utils.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -12,92 +15,103 @@ import com.zkqy.business.service.IProductOutboundRecordService;
 
 /**
  * 成品出库记录Service业务层处理
- * 
+ *
  * @author zkqy
  * @date 2024-04-09
  */
 @Service
-public class ProductOutboundRecordServiceImpl implements IProductOutboundRecordService 
-{
+public class ProductOutboundRecordServiceImpl implements IProductOutboundRecordService {
     @Autowired
     private ProductOutboundRecordMapper productOutboundRecordMapper;
 
+    @Autowired
+    private ProductInvoiceMapper productInvoiceMapper;
+
     /**
      * 查询成品出库记录
-     * 
+     *
      * @param id 成品出库记录主键
      * @return 成品出库记录
      */
     @Override
-    public ProductOutboundRecord selectProductOutboundRecordById(Long id)
-    {
+    public ProductOutboundRecord selectProductOutboundRecordById(Long id) {
         return productOutboundRecordMapper.selectProductOutboundRecordById(id);
     }
 
     /**
      * 查询成品出库记录列表
-     * 
+     *
      * @param vo 成品出库记录
      * @return 成品出库记录
      */
     @Override
-    public List<ProductCodeListVO> selectProductOutboundRecordList(ProductCodeListVO vo)
-    {
+    public List<ProductCodeListVO> selectProductOutboundRecordList(ProductCodeListVO vo) {
         return productOutboundRecordMapper.selectList(vo);
     }
 
     /**
      * 新增成品出库记录
-     * 
+     *
      * @param productOutboundRecord 成品出库记录
      * @return 结果
      */
     @Override
-    public int insertProductOutboundRecord(ProductOutboundRecord productOutboundRecord)
-    {
+    public int insertProductOutboundRecord(ProductOutboundRecord productOutboundRecord) {
         productOutboundRecord.setCreateTime(DateUtils.getNowDate());
         return productOutboundRecordMapper.insertProductOutboundRecord(productOutboundRecord);
     }
 
     /**
      * 修改成品出库记录
-     * 
+     *
      * @param productOutboundRecord 成品出库记录
      * @return 结果
      */
     @Override
-    public int updateProductOutboundRecord(ProductOutboundRecord productOutboundRecord)
-    {
+    public int updateProductOutboundRecord(ProductOutboundRecord productOutboundRecord) {
         productOutboundRecord.setUpdateTime(DateUtils.getNowDate());
         return productOutboundRecordMapper.updateProductOutboundRecord(productOutboundRecord);
     }
 
     /**
      * 批量删除成品出库记录
-     * 
+     *
      * @param ids 需要删除的成品出库记录主键
      * @return 结果
      */
     @Override
-    public int deleteProductOutboundRecordByIds(Long[] ids)
-    {
+    public int deleteProductOutboundRecordByIds(Long[] ids) {
         return productOutboundRecordMapper.deleteProductOutboundRecordByIds(ids);
     }
 
     /**
      * 删除成品出库记录信息
-     * 
+     *
      * @param id 成品出库记录主键
      * @return 结果
      */
     @Override
-    public int deleteProductOutboundRecordById(Long id)
-    {
+    public int deleteProductOutboundRecordById(Long id) {
         return productOutboundRecordMapper.deleteProductOutboundRecordById(id);
     }
 
     @Override
     public ProductOutboundRecord whetherStorage(String qrCode, String qrCodeId) {
-        return productOutboundRecordMapper.selectProductOutboundRecordWhetherExist(qrCode,qrCodeId);
+        return productOutboundRecordMapper.selectProductOutboundRecordWhetherExist(qrCode, qrCodeId);
+    }
+
+    @Override
+    public int deleteProductOutboundRecordByUUID(String qrCodeId) {
+        return productOutboundRecordMapper.deleteProductOutboundRecordByUUID(qrCodeId);
+    }
+
+    @Override
+    public List<ProductCodeListVO> outboundDetails(String saleOrderNo) {
+        //根据销售单编号查询通知单编号
+        ProductInvoice productInvoice = productInvoiceMapper.selectProductInvoiceBySaleOrderNo(saleOrderNo);
+        if(productInvoice == null){
+            return new ArrayList<>();
+        }
+        return productOutboundRecordMapper.selectOutboundDetails(productInvoice.getNoticeNumber());
     }
 }

+ 117 - 2
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/SaleOrderServiceImpl.java

@@ -1,15 +1,17 @@
 package com.zkqy.business.service.impl;
 
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;
 
+import com.zkqy.business.domain.ProductInvoice;
 import com.zkqy.business.domain.SaleProducts;
 import com.zkqy.business.domain.vo.SaleOrderVO;
+import com.zkqy.business.mapper.ProductInvoiceMapper;
 import com.zkqy.business.mapper.SaleCraftMapper;
 import com.zkqy.business.mapper.SaleProductsMapper;
 import com.zkqy.common.core.domain.entity.SysRole;
 import com.zkqy.common.utils.DateUtils;
 import com.zkqy.common.utils.SecurityUtils;
+import com.zkqy.common.utils.bean.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.zkqy.business.mapper.SaleOrderMapper;
@@ -35,6 +37,9 @@ public class SaleOrderServiceImpl implements ISaleOrderService
     @Autowired
     private SaleCraftMapper saleCraftMapper;
 
+    @Autowired
+    private ProductInvoiceMapper productInvoiceMapper;
+
     /**
      * 查询销售订单
      * 
@@ -182,4 +187,114 @@ public class SaleOrderServiceImpl implements ISaleOrderService
         }
         return saleOrderVOS;
     }
+
+    @Override
+    @Transactional
+    public int addRetailOrder(SaleOrderVO vo) {
+        //新增零售单
+        SaleOrder saleOrder = new SaleOrder();
+        BeanUtils.copyBeanProp(saleOrder,vo);
+        saleOrder.setCreateBy(SecurityUtils.getUsername());
+        saleOrder.setCreateTime(DateUtils.getNowDate());
+        saleOrderMapper.insertSaleOrder(saleOrder);
+        //新增零售单货品
+        vo.getSaleProductsList().forEach(saleProducts -> {
+            saleProducts.setSaleOrderNo(saleOrder.getSaleNo());
+            saleProducts.setCreateBy(SecurityUtils.getUsername());
+            saleProducts.setCreateTime(DateUtils.getNowDate());
+        });
+        return saleProductsMapper.batchInsertSaleProducts(vo.getSaleProductsList());
+    }
+
+    @Override
+    public SaleOrderVO getRetailOrderInfo(Long id) {
+        // 零售单
+        SaleOrderVO saleOrderVO = new SaleOrderVO();
+        SaleOrder saleOrder = saleOrderMapper.selectSaleOrderById(id);
+        BeanUtils.copyBeanProp(saleOrderVO,saleOrder);
+
+        // 零售单货品详情
+        SaleProducts saleProducts = new SaleProducts();
+        saleProducts.setSaleOrderNo(saleOrder.getSaleNo());
+        List<SaleProducts> saleProductsList = saleProductsMapper.selectSaleProductsList(saleProducts);
+        saleOrderVO.setSaleProductsList(saleProductsList);
+        return saleOrderVO;
+    }
+
+    @Override
+    @Transactional
+    public int editRetailOrder(SaleOrderVO vo) {
+        //修改零售单
+        SaleOrder saleOrder = new SaleOrder();
+        BeanUtils.copyBeanProp(saleOrder,vo);
+
+
+        //修改零售单货品详情
+        LinkedList<SaleProducts> addSaleProductsList = new LinkedList<>();
+        LinkedList<SaleProducts> updateSaleProductsList = new LinkedList<>();
+        Set<Long> ids = new HashSet<>();
+
+        vo.getSaleProductsList().forEach(saleProducts -> {
+            if(saleProducts.getId() != null){
+                ids.add(saleProducts.getId());
+                saleProducts.setUpdateById(SecurityUtils.getUserId());
+                saleProducts.setUpdateTime(DateUtils.getNowDate());
+                saleOrder.setUpdateBy(SecurityUtils.getUsername());
+                updateSaleProductsList.add(saleProducts);
+            }else {
+                saleProducts.setCreateById(SecurityUtils.getUserId());
+                saleProducts.setCreateBy(SecurityUtils.getUsername());
+                saleProducts.setCreateTime(DateUtils.getNowDate());
+                addSaleProductsList.add(saleProducts);
+            }
+        });
+
+        //查询零售单货品编号
+        Set<Long> allIds = saleProductsMapper.selectSaleProductsIdsBySaleNo(saleOrder.getSaleNo());
+        allIds.removeAll(ids);
+        // remove
+        if(allIds.size() > 0){
+            saleProductsMapper.deleteSaleProductsByIds(new ArrayList<>(allIds));
+        }
+        // add
+        if(addSaleProductsList.size() > 0){
+            saleProductsMapper.batchInsertSaleProducts(addSaleProductsList);
+        }
+        if(updateSaleProductsList.size() > 0){
+            updateSaleProductsList.forEach(saleProducts -> {
+                saleProductsMapper.updateSaleProducts(saleProducts);
+            });
+        }
+        return saleOrderMapper.updateSaleOrder(saleOrder);
+    }
+
+    @Override
+    @Transactional
+    public int submitRetailOrder(ProductInvoice productInvoice) {
+
+        //修改零售单状态
+        SaleOrder saleOrder = new SaleOrder();
+        saleOrder.setSaleNo(productInvoice.getSaleOrderNo());
+        saleOrder.setStatus(productInvoice.getStatus());
+        saleOrderMapper.updateSaleOrderBySaleNo(saleOrder);
+        //新增通知单
+        productInvoice.setStatus("1");
+        return productInvoiceMapper.insertProductInvoice(productInvoice);
+
+    }
+
+    @Override
+    @Transactional
+    public int cancelRetailOrder(ProductInvoice productInvoice) {
+
+        //删除通知单
+        productInvoiceMapper.deleteProductInvoiceBySaleOrderNo(productInvoice.getSaleOrderNo());
+
+        //修改零售单状态
+        SaleOrder saleOrder = new SaleOrder();
+        saleOrder.setSaleNo(productInvoice.getSaleOrderNo());
+        saleOrder.setStatus(productInvoice.getStatus());
+        return saleOrderMapper.updateSaleOrderBySaleNo(saleOrder);
+    }
+
 }

+ 43 - 0
zkqy-custom-business/src/main/resources/mapper/business/CustomerMapper.xml

@@ -160,4 +160,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where custom_no = #{customerNo} and del_flag = '0'
     </select>
 
+    <insert id="batchInsertCustomer" parameterType="com.zkqy.business.domain.Customer">
+        INSERT INTO {DBNAME}.customer (
+        custom_no,
+        custom_name,
+        custom_phone_number,
+        custom_landine,
+        custom_mail,
+        custom_type,
+        custom_grade,
+        custom_address,
+        custom_country_type,
+        custom_district,
+        salesman,
+        contact_person,
+        remark,
+        create_by_id,
+        create_by,
+        create_time,
+        del_flag
+        ) VALUES
+        <foreach collection="list" item="item" index="index" separator=",">
+            (
+            #{item.customNo},
+            #{item.customName},
+            #{item.customPhoneNumber},
+            #{item.customLandine},
+            #{item.customMail},
+            #{item.customType},
+            #{item.customGrade},
+            #{item.customAddress},
+            #{item.customCountryType},
+            #{item.customDistrict},
+            #{item.salesman},
+            #{item.contactPerson},
+            #{item.remark},
+            #{item.createById},
+            #{item.createBy},
+            #{item.createTime},
+            '0'
+            )
+        </foreach>
+    </insert>
+
 </mapper>

+ 2 - 1
zkqy-custom-business/src/main/resources/mapper/business/ProductCodeListMapper.xml

@@ -232,7 +232,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </update>
 
     <delete id="deleteProductCodeListById" parameterType="Long">
-        delete from product_code_list where id = #{id}
+        update {DBNAME}.product_code_list set del_flag = '2' where id = #{id}
     </delete>
 
     <update id="deleteProductCodeListByIds" parameterType="String">
@@ -262,6 +262,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           AND sc.del_flag = '0'
             and ml.del_flag = '0'
             and sp.status = '6'
+        <if test="machineTool != null"> and sp.production_line_no = #{machineTool}</if>
     </select>
 
     <select id="selectMaxCodeList" resultType="string">

+ 6 - 13
zkqy-custom-business/src/main/resources/mapper/business/ProductInventoryMapper.xml

@@ -110,18 +110,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="storageLocation != null">storage_location,</if>
             <if test="warehouseregionId != null">warehouseregion_id,</if>
             <if test="remark != null">remark,</if>
-            <if test="delFlag != null">del_flag,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createById != null">create_by_id,</if>
             <if test="createTime != null">create_time,</if>
-            <if test="updateBy != null">update_by,</if>
-            <if test="updateById != null">update_by_id,</if>
-            <if test="updateTime != null">update_time,</if>
             <if test="totalCanisterNum != null">total_canister_num,</if>
             <if test="totalBoxNum != null">total_box_num,</if>
             <if test="totalSuttle != null">total_suttle,</if>
             <if test="totalGrossWeight != null">total_gross_weight,</if>
             <if test="productColour != null">product_colour,</if>
+            del_flag
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="qrCode != null">#{qrCode},</if>
@@ -147,18 +144,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="storageLocation != null">#{storageLocation},</if>
             <if test="warehouseregionId != null">#{warehouseregionId},</if>
             <if test="remark != null">#{remark},</if>
-            <if test="delFlag != null">#{delFlag},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createById != null">#{createById},</if>
             <if test="createTime != null">#{createTime},</if>
-            <if test="updateBy != null">#{updateBy},</if>
-            <if test="updateById != null">#{updateById},</if>
-            <if test="updateTime != null">#{updateTime},</if>
             <if test="totalCanisterNum != null">#{totalCanisterNum},</if>
             <if test="totalBoxNum != null">#{totalBoxNum},</if>
             <if test="totalSuttle != null">#{totalSuttle},</if>
             <if test="totalGrossWeight != null">#{totalGrossWeight},</if>
             <if test="productColour != null">#{productColour},</if>
+            '0'
          </trim>
     </insert>
 
@@ -188,10 +182,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="storageLocation != null">storage_location = #{storageLocation},</if>
             <if test="warehouseregionId != null">warehouseregion_id = #{warehouseregionId},</if>
             <if test="remark != null">remark = #{remark},</if>
-            <if test="delFlag != null">del_flag = #{delFlag},</if>
-            <if test="createBy != null">create_by = #{createBy},</if>
-            <if test="createById != null">create_by_id = #{createById},</if>
-            <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateById != null">update_by_id = #{updateById},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
@@ -221,7 +211,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="selectProductInventoryByLotNumAndProductId" resultType="com.zkqy.business.domain.ProductInventory">
-        select sum(total_box_num) as totalBoxNum,sum(total_suttle) as totalSuttle  from {DBNAME}.product_inventory where lot_num = #{lotNum} and product_id = #{productId}
+        select sum(total_box_num) as totalBoxNum,sum(total_suttle) as totalSuttle  from {DBNAME}.product_inventory
+        where del_flag = '0'
+        <if test="lotNum != null">and lot_num = #{lotNum}</if>
+        <if test="productId != null">and product_id = #{productId}</if>
     </select>
 
 </mapper>

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

@@ -178,4 +178,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectProductInvoiceVo"/>
         where sale_order_no = #{saleOrderNo} and del_flag = '0'
     </select>
+
+    <update id="deleteProductInvoiceBySaleOrderNo" parameterType="String">
+        update {DBNAME}.product_invoice set del_flag = '2' where sale_order_no = #{saleOrderNo}
+    </update>
+
 </mapper>

+ 181 - 111
zkqy-custom-business/src/main/resources/mapper/business/ProductOutboundRecordMapper.xml

@@ -1,133 +1,174 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.zkqy.business.mapper.ProductOutboundRecordMapper">
-    
+
     <resultMap type="com.zkqy.business.domain.ProductOutboundRecord" id="ProductOutboundRecordResult">
-        <result property="id"    column="id"    />
-        <result property="qrCode"    column="qr_code"    />
-        <result property="qrCodeId"    column="qr_code_id"    />
-        <result property="lotNum"    column="lot_num"    />
-        <result property="productId"    column="product_id"    />
-        <result property="levels"    column="levels"    />
-        <result property="canisterNum"    column="canister_num"    />
-        <result property="boxNum"    column="box_num"    />
-        <result property="suttle"    column="suttle"    />
-        <result property="productionDate"    column="production_date"    />
-        <result property="machineTool"    column="machine_tool"    />
-        <result property="grossWeight"    column="gross_weight"    />
-        <result property="packaging"    column="packaging"    />
-        <result property="workShifts"    column="work_shifts"    />
-        <result property="foreignTradeNumber"    column="foreign_trade_number"    />
-        <result property="canisterWeight"    column="canister_weight"    />
-        <result property="boxWeight"    column="box_weight"    />
-        <result property="tubeColor"    column="tube_color"    />
-        <result property="comPort"    column="com_port"    />
-        <result property="printFormat"    column="print_format"    />
-        <result property="packagingType"    column="packaging_type"    />
-        <result property="storageLocation"    column="storage_location"    />
-        <result property="warehouseregionId"    column="warehouseregion_id"    />
-        <result property="remark"    column="remark"    />
-        <result property="delFlag"    column="del_flag"    />
-        <result property="createBy"    column="create_by"    />
-        <result property="createById"    column="create_by_id"    />
-        <result property="createTime"    column="create_time"    />
-        <result property="updateBy"    column="update_by"    />
-        <result property="updateById"    column="update_by_id"    />
-        <result property="updateTime"    column="update_time"    />
-        <result property="warehousingTime"    column="warehousing_time"    />
-        <result property="depositor"    column="depositor"    />
-        <result property="warehouseId"    column="warehouse_id"    />
+        <result property="id" column="id"/>
+        <result property="qrCode" column="qr_code"/>
+        <result property="qrCodeId" column="qr_code_id"/>
+        <result property="lotNum" column="lot_num"/>
+        <result property="productId" column="product_id"/>
+        <result property="levels" column="levels"/>
+        <result property="canisterNum" column="canister_num"/>
+        <result property="boxNum" column="box_num"/>
+        <result property="suttle" column="suttle"/>
+        <result property="productionDate" column="production_date"/>
+        <result property="machineTool" column="machine_tool"/>
+        <result property="grossWeight" column="gross_weight"/>
+        <result property="packaging" column="packaging"/>
+        <result property="workShifts" column="work_shifts"/>
+        <result property="foreignTradeNumber" column="foreign_trade_number"/>
+        <result property="canisterWeight" column="canister_weight"/>
+        <result property="boxWeight" column="box_weight"/>
+        <result property="tubeColor" column="tube_color"/>
+        <result property="comPort" column="com_port"/>
+        <result property="printFormat" column="print_format"/>
+        <result property="packagingType" column="packaging_type"/>
+        <result property="storageLocation" column="storage_location"/>
+        <result property="warehouseregionId" column="warehouseregion_id"/>
+        <result property="remark" column="remark"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createById" column="create_by_id"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateById" column="update_by_id"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="warehousingTime" column="warehousing_time"/>
+        <result property="depositor" column="depositor"/>
+        <result property="warehouseId" column="warehouse_id"/>
         <result property="noticeNumber" column="notice_number"/>
         <result property="productColour" column="product_colour"/>
     </resultMap>
 
     <resultMap type="com.zkqy.business.domain.vo.ProductCodeListVO" id="ProductCodeListResultVO">
-        <result property="id"    column="id"    />
-        <result property="qrCode"    column="qr_code"    />
-        <result property="lotNum"    column="lot_num"    />
-        <result property="productId"    column="product_id"    />
-        <result property="levels"    column="levels"    />
-        <result property="canisterNum"    column="canister_num"    />
-        <result property="boxNum"    column="box_num"    />
-        <result property="suttle"    column="suttle"    />
-        <result property="productionDate"    column="production_date"    />
-        <result property="machineTool"    column="machine_tool"    />
-        <result property="grossWeight"    column="gross_weight"    />
-        <result property="packaging"    column="packaging"    />
-        <result property="workShifts"    column="work_shifts"    />
-        <result property="foreignTradeNumber"    column="foreign_trade_number"    />
-        <result property="canisterWeight"    column="canister_weight"    />
-        <result property="boxWeight"    column="box_weight"    />
-        <result property="tubeColor"    column="tube_color"    />
-        <result property="comPort"    column="com_port"    />
-        <result property="printFormat"    column="print_format"    />
-        <result property="packagingType"    column="packaging_type"    />
-        <result property="storageLocation"    column="storage_location"    />
-        <result property="warehouseregionId"    column="warehouseregion_id"    />
-        <result property="remark"    column="remark"    />
-        <result property="delFlag"    column="del_flag"    />
-        <result property="createBy"    column="create_by"    />
-        <result property="createById"    column="create_by_id"    />
-        <result property="createTime"    column="create_time"    />
-        <result property="updateBy"    column="update_by"    />
-        <result property="updateById"    column="update_by_id"    />
-        <result property="updateTime"    column="update_time"    />
-        <result property="productName"    column="product_name"    />
+        <result property="id" column="id"/>
+        <result property="qrCode" column="qr_code"/>
+        <result property="lotNum" column="lot_num"/>
+        <result property="productId" column="product_id"/>
+        <result property="levels" column="levels"/>
+        <result property="canisterNum" column="canister_num"/>
+        <result property="boxNum" column="box_num"/>
+        <result property="suttle" column="suttle"/>
+        <result property="productionDate" column="production_date"/>
+        <result property="machineTool" column="machine_tool"/>
+        <result property="grossWeight" column="gross_weight"/>
+        <result property="packaging" column="packaging"/>
+        <result property="workShifts" column="work_shifts"/>
+        <result property="foreignTradeNumber" column="foreign_trade_number"/>
+        <result property="canisterWeight" column="canister_weight"/>
+        <result property="boxWeight" column="box_weight"/>
+        <result property="tubeColor" column="tube_color"/>
+        <result property="comPort" column="com_port"/>
+        <result property="printFormat" column="print_format"/>
+        <result property="packagingType" column="packaging_type"/>
+        <result property="storageLocation" column="storage_location"/>
+        <result property="warehouseregionId" column="warehouseregion_id"/>
+        <result property="remark" column="remark"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createById" column="create_by_id"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateById" column="update_by_id"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="productName" column="product_name"/>
         <result property="productColor" column="product_color"/>
         <result property="productSpecifications" column="product_specifications"/>
         <result property="totalCanisterNum" column="total_canister_num"/>
         <result property="totalBoxNum" column="total_box_num"/>
         <result property="totalSuttle" column="total_suttle"/>
         <result property="totalGrossWeight" column="total_gross_weight"/>
-        <result property="warehousingTime"    column="warehousing_time"    />
-        <result property="depositor"    column="depositor"    />
+        <result property="warehousingTime" column="warehousing_time"/>
+        <result property="depositor" column="depositor"/>
         <result property="warehouseId" column="warehouse_id"/>
         <result property="productColour" column="product_colour"/>
+        <result property="customName" column="custom_name"/>
     </resultMap>
 
     <sql id="selectProductOutboundRecordVo">
-        select id, qr_code, qr_code_id, lot_num, product_id, levels, canister_num, box_num, suttle, production_date, machine_tool, gross_weight, packaging, work_shifts, foreign_trade_number, canister_weight, box_weight, tube_color, com_port, print_format, packaging_type, storage_location, warehouseregion_id, remark, del_flag, create_by, create_by_id, create_time, update_by, update_by_id, update_time, warehousing_time, depositor, warehouse_id,notice_number,product_colour from {DBNAME}.product_outbound_record
+        select id,
+               qr_code,
+               qr_code_id,
+               lot_num,
+               product_id,
+               levels,
+               canister_num,
+               box_num,
+               suttle,
+               production_date,
+               machine_tool,
+               gross_weight,
+               packaging,
+               work_shifts,
+               foreign_trade_number,
+               canister_weight,
+               box_weight,
+               tube_color,
+               com_port,
+               print_format,
+               packaging_type,
+               storage_location,
+               warehouseregion_id,
+               remark,
+               del_flag,
+               create_by,
+               create_by_id,
+               create_time,
+               update_by,
+               update_by_id,
+               update_time,
+               warehousing_time,
+               depositor,
+               warehouse_id,
+               notice_number,
+               product_colour
+        from {DBNAME}.product_outbound_record
     </sql>
 
-    <select id="selectProductOutboundRecordList" parameterType="com.zkqy.business.domain.ProductOutboundRecord" resultMap="ProductOutboundRecordResult">
+    <select id="selectProductOutboundRecordList" parameterType="com.zkqy.business.domain.ProductOutboundRecord"
+            resultMap="ProductOutboundRecordResult">
         <include refid="selectProductOutboundRecordVo"/>
-        <where>  
-            <if test="qrCode != null  and qrCode != ''"> and qr_code = #{qrCode}</if>
-            <if test="qrCodeId != null  and qrCodeId != ''"> and qr_code_id = #{qrCodeId}</if>
-            <if test="lotNum != null  and lotNum != ''"> and lot_num = #{lotNum}</if>
-            <if test="productId != null "> and product_id = #{productId}</if>
-            <if test="levels != null  and levels != ''"> and levels = #{levels}</if>
-            <if test="canisterNum != null "> and canister_num = #{canisterNum}</if>
-            <if test="boxNum != null "> and box_num = #{boxNum}</if>
-            <if test="suttle != null "> and suttle = #{suttle}</if>
-            <if test="productionDate != null "> and production_date = #{productionDate}</if>
-            <if test="machineTool != null  and machineTool != ''"> and machine_tool = #{machineTool}</if>
-            <if test="grossWeight != null "> and gross_weight = #{grossWeight}</if>
-            <if test="packaging != null  and packaging != ''"> and packaging = #{packaging}</if>
-            <if test="workShifts != null  and workShifts != ''"> and work_shifts = #{workShifts}</if>
-            <if test="foreignTradeNumber != null  and foreignTradeNumber != ''"> and foreign_trade_number = #{foreignTradeNumber}</if>
-            <if test="canisterWeight != null "> and canister_weight = #{canisterWeight}</if>
-            <if test="boxWeight != null "> and box_weight = #{boxWeight}</if>
-            <if test="tubeColor != null  and tubeColor != ''"> and tube_color = #{tubeColor}</if>
-            <if test="comPort != null  and comPort != ''"> and com_port = #{comPort}</if>
-            <if test="printFormat != null  and printFormat != ''"> and print_format = #{printFormat}</if>
-            <if test="packagingType != null  and packagingType != ''"> and packaging_type = #{packagingType}</if>
-            <if test="storageLocation != null  and storageLocation != ''"> and storage_location = #{storageLocation}</if>
-            <if test="warehouseregionId != null "> and warehouseregion_id = #{warehouseregionId}</if>
-            <if test="warehousingTime != null "> and warehousing_time = #{warehousingTime}</if>
-            <if test="depositor != null  and depositor != ''"> and depositor = #{depositor}</if>
-            <if test="warehouseId != null "> and warehouse_id = #{warehouseId}</if>
+        <where>
+            <if test="qrCode != null  and qrCode != ''">and qr_code = #{qrCode}</if>
+            <if test="qrCodeId != null  and qrCodeId != ''">and qr_code_id = #{qrCodeId}</if>
+            <if test="lotNum != null  and lotNum != ''">and lot_num = #{lotNum}</if>
+            <if test="productId != null ">and product_id = #{productId}</if>
+            <if test="levels != null  and levels != ''">and levels = #{levels}</if>
+            <if test="canisterNum != null ">and canister_num = #{canisterNum}</if>
+            <if test="boxNum != null ">and box_num = #{boxNum}</if>
+            <if test="suttle != null ">and suttle = #{suttle}</if>
+            <if test="productionDate != null ">and production_date = #{productionDate}</if>
+            <if test="machineTool != null  and machineTool != ''">and machine_tool = #{machineTool}</if>
+            <if test="grossWeight != null ">and gross_weight = #{grossWeight}</if>
+            <if test="packaging != null  and packaging != ''">and packaging = #{packaging}</if>
+            <if test="workShifts != null  and workShifts != ''">and work_shifts = #{workShifts}</if>
+            <if test="foreignTradeNumber != null  and foreignTradeNumber != ''">and foreign_trade_number =
+                #{foreignTradeNumber}
+            </if>
+            <if test="canisterWeight != null ">and canister_weight = #{canisterWeight}</if>
+            <if test="boxWeight != null ">and box_weight = #{boxWeight}</if>
+            <if test="tubeColor != null  and tubeColor != ''">and tube_color = #{tubeColor}</if>
+            <if test="comPort != null  and comPort != ''">and com_port = #{comPort}</if>
+            <if test="printFormat != null  and printFormat != ''">and print_format = #{printFormat}</if>
+            <if test="packagingType != null  and packagingType != ''">and packaging_type = #{packagingType}</if>
+            <if test="storageLocation != null  and storageLocation != ''">and storage_location = #{storageLocation}</if>
+            <if test="warehouseregionId != null ">and warehouseregion_id = #{warehouseregionId}</if>
+            <if test="warehousingTime != null ">and warehousing_time = #{warehousingTime}</if>
+            <if test="depositor != null  and depositor != ''">and depositor = #{depositor}</if>
+            <if test="warehouseId != null ">and warehouse_id = #{warehouseId}</if>
         </where>
     </select>
-    
+
     <select id="selectProductOutboundRecordById" parameterType="Long" resultMap="ProductOutboundRecordResult">
         <include refid="selectProductOutboundRecordVo"/>
         where id = #{id}
     </select>
-        
-    <insert id="insertProductOutboundRecord" parameterType="com.zkqy.business.domain.ProductOutboundRecord" useGeneratedKeys="true" keyProperty="id">
+
+    <insert id="insertProductOutboundRecord" parameterType="com.zkqy.business.domain.ProductOutboundRecord"
+            useGeneratedKeys="true" keyProperty="id">
         insert into {DBNAME}.product_outbound_record
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="qrCode != null">qr_code,</if>
@@ -162,7 +203,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="noticeNumber != null">notice_number,</if>
             <if test="productColour != null">product_colour,</if>
             del_flag
-         </trim>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="qrCode != null">#{qrCode},</if>
             <if test="qrCodeId != null">#{qrCodeId},</if>
@@ -196,7 +237,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="noticeNumber != null">#{noticeNumber},</if>
             <if test="productColour != null">#{productColour},</if>
             '0'
-         </trim>
+        </trim>
     </insert>
 
     <update id="updateProductOutboundRecord" parameterType="com.zkqy.business.domain.ProductOutboundRecord">
@@ -238,17 +279,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </update>
 
     <delete id="deleteProductOutboundRecordById" parameterType="Long">
-        delete from product_outbound_record where id = #{id}
+        delete
+        from product_outbound_record
+        where id = #{id}
     </delete>
 
     <delete id="deleteProductOutboundRecordByIds" parameterType="String">
-        delete from product_outbound_record where id in 
+        delete from product_outbound_record where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>
     </delete>
 
-    <select id="selectList" parameterType="com.zkqy.business.domain.vo.ProductCodeListVO" resultMap="ProductCodeListResultVO">
+    <select id="selectList" parameterType="com.zkqy.business.domain.vo.ProductCodeListVO"
+            resultMap="ProductCodeListResultVO">
         SELECT
         r.qr_code,
         p.product_name,
@@ -270,10 +314,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         WHERE
         r.del_flag = '0'
         <if test="qrCode != null and qrCode != ''">and r.qr_code like concat('%', #{qrCode}, '%')</if>
-        <if test="lotNum != null  and lotNum != ''"> and r.lot_num like concat('%', #{lotNum}, '%')</if>
-        <if test="productionDate != null"> and r.production_date = #{productionDate}</if>
-        <if test="warehousingTime != null "> and r.warehousing_time = #{warehousingTime}</if>
-        <if test="depositor != null  and depositor != ''"> and r.depositor like concat('%', #{depositor}, '%')</if>
+        <if test="lotNum != null  and lotNum != ''">and r.lot_num like concat('%', #{lotNum}, '%')</if>
+        <if test="productionDate != null">and r.production_date = #{productionDate}</if>
+        <if test="warehousingTime != null ">and r.warehousing_time = #{warehousingTime}</if>
+        <if test="depositor != null  and depositor != ''">and r.depositor like concat('%', #{depositor}, '%')</if>
         GROUP BY
         r.qr_code
     </select>
@@ -284,7 +328,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="statisticsBoxNumSuttle" resultType="com.zkqy.business.domain.ProductOutboundRecord">
-        select count(1) as boxNum , sum(suttle) as suttle from {DBNAME}.product_outbound_record where product_id = #{productId} and notice_number = #{noticeNumber} and qr_code = #{qrCode}
+        select count(1) as boxNum, sum(suttle) as suttle
+        from {DBNAME}.product_outbound_record
+        where product_id = #{productId}
+          and notice_number = #{noticeNumber}
+          and qr_code = #{qrCode}
+    </select>
+
+    <delete id="deleteProductOutboundRecordByUUID" parameterType="string">
+        update {DBNAME}.product_outbound_record
+        set del_flag = '0'
+        where qr_code_id = #{qrCodeId}
+    </delete>
+
+    <select id="selectOutboundDetails" parameterType="com.zkqy.business.domain.vo.ProductCodeListVO" resultMap="ProductCodeListResultVO">
+        SELECT
+            r.*,
+            p.product_name,
+            p.product_specifications,
+            r.product_colour AS product_color,
+            c.custom_name
+        FROM
+            {DBNAME}.product_outbound_record r
+                LEFT JOIN {DBNAME}.production p ON r.product_id = p.id
+                LEFT JOIN {DBNAME}.product_invoice pi ON r.notice_number = pi.notice_number
+                AND pi.del_flag = '0'
+                LEFT JOIN {DBNAME}.customer c ON pi.customer_id = c.id
+        where r.del_flag = '0' and r.notice_number = #{noticeNumber}
     </select>
 
 </mapper>

+ 10 - 12
zkqy-custom-business/src/main/resources/mapper/business/ProductWarehousingRecordMapper.xml

@@ -236,11 +236,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </update>
 
     <delete id="deleteProductWarehousingRecordById" parameterType="Long">
-        delete from product_warehousing_record where id = #{id}
+        update {DBNAME}.product_warehousing_record set del_flag = '2' where id = #{id}
     </delete>
 
     <delete id="deleteProductWarehousingRecordByIds" parameterType="String">
-        delete from product_warehousing_record where id in 
+        update {DBNAME}.product_warehousing_record set del_flag = '2' where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>
@@ -248,20 +248,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectList" parameterType="com.zkqy.business.domain.vo.ProductCodeListVO" resultMap="ProductCodeListResultVO">
         SELECT
-            r.qr_code,
+            r.*,
             p.product_name,
             p.product_specifications,
             r.product_colour as product_color,
-            r.lot_num,
-            r.levels,
-            r.packaging,
-            r.warehousing_time,
-            r.depositor,
             count( r.id ) AS total_box_num,
-            sum( r.gross_weight ) AS total_gross_weight,
-            r.work_shifts,
-            r.production_date,
-            r.remark
+            sum( r.gross_weight ) AS total_gross_weight
         FROM
         {DBNAME}.product_warehousing_record r
                 LEFT JOIN {DBNAME}.production p ON r.product_id = p.id
@@ -281,4 +273,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where del_flag = '0' and qr_code = #{qrCode} and qr_code_id = #{qrCodeId}
     </select>
 
+    <delete id="deleteProductWarehousingRecordByUUID" parameterType="string">
+        update {DBNAME}.product_warehousing_record
+        set del_flag = '0'
+        where qr_code_id = #{qrCodeId}
+    </delete>
+
 </mapper>

+ 21 - 14
zkqy-custom-business/src/main/resources/mapper/business/SaleOrderMapper.xml

@@ -37,10 +37,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="processKey"    column="process_key"    />
         <result property="earnestMoney"    column="earnest_money"    />
         <result property="deliveryDate"    column="delivery_date"    />
+        <result property="lotNumber" column="lot_number"/>
+
     </resultMap>
 
     <sql id="selectSaleOrderVo">
-        select id, sale_no, sale_custom_no, sale_date, sale_estimated_time, sale_lead_time, sale_products_no, sale_amounts, sale_amount_in_words, sale_pay_type, sale_order_estimated_time, sale_order_technology_no, salesman, sale_leader, finance, production, sale_approver, status, order_type, remark, create_by_id, create_by, create_time, update_by_id, update_by, update_time, del_flag, task_process_key, task_node_key, process_key, earnest_money, delivery_date from {DBNAME}.sale_order
+        select id, sale_no, sale_custom_no, sale_date, sale_estimated_time, sale_lead_time, sale_products_no, sale_amounts, sale_amount_in_words, sale_pay_type, sale_order_estimated_time, sale_order_technology_no, salesman, sale_leader, finance, production, sale_approver, status, order_type, remark, create_by_id, create_by, create_time, update_by_id, update_by, update_time, del_flag, task_process_key, task_node_key, process_key, earnest_money, delivery_date, lot_number from {DBNAME}.sale_order
     </sql>
 
     <select id="selectSaleOrderList" parameterType="com.zkqy.business.domain.SaleOrder" resultMap="SaleOrderResult">
@@ -79,7 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
         
     <insert id="insertSaleOrder" parameterType="com.zkqy.business.domain.SaleOrder" useGeneratedKeys="true" keyProperty="id">
-        insert into sale_order
+        insert into {DBNAME}.sale_order
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="saleNo != null">sale_no,</if>
             <if test="saleCustomNo != null">sale_custom_no,</if>
@@ -103,15 +105,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createById != null">create_by_id,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createTime != null">create_time,</if>
-            <if test="updateById != null">update_by_id,</if>
-            <if test="updateBy != null">update_by,</if>
-            <if test="updateTime != null">update_time,</if>
-            <if test="delFlag != null">del_flag,</if>
             <if test="taskProcessKey != null">task_process_key,</if>
             <if test="taskNodeKey != null">task_node_key,</if>
             <if test="processKey != null">process_key,</if>
             <if test="earnestMoney != null">earnest_money,</if>
             <if test="deliveryDate != null">delivery_date,</if>
+            <if test="lotNumber != null">lot_number,</if>
+            del_flag
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="saleNo != null">#{saleNo},</if>
@@ -136,15 +136,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createById != null">#{createById},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
-            <if test="updateById != null">#{updateById},</if>
-            <if test="updateBy != null">#{updateBy},</if>
-            <if test="updateTime != null">#{updateTime},</if>
-            <if test="delFlag != null">#{delFlag},</if>
             <if test="taskProcessKey != null">#{taskProcessKey},</if>
             <if test="taskNodeKey != null">#{taskNodeKey},</if>
             <if test="processKey != null">#{processKey},</if>
             <if test="earnestMoney != null">#{earnestMoney},</if>
             <if test="deliveryDate != null">#{deliveryDate},</if>
+            <if test="lotNumber != null">#{lotNumber},</if>
+            '0'
          </trim>
     </insert>
 
@@ -171,17 +169,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="orderType != null">order_type = #{orderType},</if>
             <if test="remark != null">remark = #{remark},</if>
             <if test="createById != null">create_by_id = #{createById},</if>
-            <if test="createBy != null">create_by = #{createBy},</if>
-            <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateById != null">update_by_id = #{updateById},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
-            <if test="delFlag != null">del_flag = #{delFlag},</if>
             <if test="taskProcessKey != null">task_process_key = #{taskProcessKey},</if>
             <if test="taskNodeKey != null">task_node_key = #{taskNodeKey},</if>
             <if test="processKey != null">process_key = #{processKey},</if>
             <if test="earnestMoney != null">earnest_money = #{earnestMoney},</if>
             <if test="deliveryDate != null">delivery_date = #{deliveryDate},</if>
+            <if test="lotNumber != null">lot_number = #{lotNumber},</if>
         </trim>
         where id = #{id}
     </update>
@@ -231,6 +227,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         update {DBNAME}.sale_order
         <trim prefix="SET" suffixOverrides=",">
             <if test="lotNumber != null">lot_number = #{lotNumber},</if>
+            <if test="status != null">status = #{status},</if>
         </trim>
         where sale_no = #{saleNo}
     </update>
@@ -263,7 +260,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             so.production,
             so.sale_approver,
             so.status,
-            so.order_type
+            so.order_type,
+            so.delivery_date,
+            so.remark
         FROM
             {DBNAME}.sale_order so left join {DBNAME}.customer c on so.sale_custom_no = c.custom_no
         where so.del_flag = '0' and c.del_flag = '0'
@@ -276,6 +275,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </if>
         <if test="createById != null "> and so.create_by_id = #{createById}</if>
         <if test="orderType != null"> and so.order_type = #{orderType}</if>
+        <choose>
+            <when test="saleOrderTechnologyNo =='retailOrder'">
+                and so.sale_order_technology_no = 'retailOrder'
+            </when>
+            <otherwise>
+                and so.sale_order_technology_no != 'retailOrder'
+            </otherwise>
+        </choose>
         order by so.id desc
     </select>
 

+ 80 - 15
zkqy-custom-business/src/main/resources/mapper/business/SaleProductsMapper.xml

@@ -30,6 +30,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="productionLineNo"    column="production_line_no"    />
         <result property="sliceType"    column="slice_type"    />
         <result property="colourNumber"    column="colour_number"    />
+        <result property="taskName" column="task_name"/>
+        <result property="lotNumber" column="lot_number"/>
+        <result property="onBoardState" column="on_board_state"/>
     </resultMap>
 
     <resultMap type="com.zkqy.business.domain.vo.SaleProductsVo" id="SaleProductsResultAndCustomInfo">
@@ -65,12 +68,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectSaleProductsVo">
-        select id, sale_product_no, sale_order_no, product_no, product_name, product_number, product_weight, product_unit_price, product_amounts, product_notes, remark, create_by_id, create_by, create_time, update_by_id, update_by, update_time, del_flag, task_process_key, task_node_key, process_key, status, production_line_no, slice_type, colour_number,lot_number from {DBNAME}.sale_products
+        select id, sale_product_no, sale_order_no, product_no, product_name, product_number, product_weight, product_unit_price, product_amounts, product_notes, remark, create_by_id, create_by, create_time, update_by_id, update_by, update_time, del_flag, task_process_key, task_node_key, process_key, status, production_line_no, slice_type, colour_number,task_name,lot_number, on_board_state from {DBNAME}.sale_products
     </sql>
 
     <select id="selectSaleProductsList" parameterType="com.zkqy.business.domain.SaleProducts" resultMap="SaleProductsResult">
         <include refid="selectSaleProductsVo"/>
-        <where>  
+        where del_flag = '0'
             <if test="saleProductNo != null  and saleProductNo != ''"> and sale_product_no = #{saleProductNo}</if>
             <if test="saleOrderNo != null  and saleOrderNo != ''"> and sale_order_no = #{saleOrderNo}</if>
             <if test="productNo != null  and productNo != ''"> and product_no = #{productNo}</if>
@@ -90,7 +93,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="sliceType != null  and sliceType != ''"> and slice_type = #{sliceType}</if>
             <if test="colourNumber != null  and colourNumber != ''"> and colour_number = #{colourNumber}</if>
             <if test="lotNumber != null  and lotNumber != ''"> and lot_number = #{lotNumber}</if>
-        </where>
     </select>
 
     <select id="selectSaleProductsListAndCustomInfo" parameterType="com.zkqy.business.domain.SaleProducts" resultMap="SaleProductsResultAndCustomInfo">
@@ -166,7 +168,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
         
     <insert id="insertSaleProducts" parameterType="com.zkqy.business.domain.SaleProducts" useGeneratedKeys="true" keyProperty="id">
-        insert into sale_products
+        insert into {DBNAME}.sale_products
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="saleProductNo != null">sale_product_no,</if>
             <if test="saleOrderNo != null">sale_order_no,</if>
@@ -181,10 +183,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createById != null">create_by_id,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createTime != null">create_time,</if>
-            <if test="updateById != null">update_by_id,</if>
-            <if test="updateBy != null">update_by,</if>
-            <if test="updateTime != null">update_time,</if>
-            <if test="delFlag != null">del_flag,</if>
             <if test="taskProcessKey != null">task_process_key,</if>
             <if test="taskNodeKey != null">task_node_key,</if>
             <if test="processKey != null">process_key,</if>
@@ -192,6 +190,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="productionLineNo != null">production_line_no,</if>
             <if test="sliceType != null">slice_type,</if>
             <if test="colourNumber != null">colour_number,</if>
+            <if test="taskName != null">task_name,</if>
+            <if test="lotNumber != null">lot_number,</if>
+            <if test="onBoardState != null">on_board_state,</if>
+            del_flag
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="saleProductNo != null">#{saleProductNo},</if>
@@ -207,10 +209,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createById != null">#{createById},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
-            <if test="updateById != null">#{updateById},</if>
-            <if test="updateBy != null">#{updateBy},</if>
-            <if test="updateTime != null">#{updateTime},</if>
-            <if test="delFlag != null">#{delFlag},</if>
             <if test="taskProcessKey != null">#{taskProcessKey},</if>
             <if test="taskNodeKey != null">#{taskNodeKey},</if>
             <if test="processKey != null">#{processKey},</if>
@@ -218,6 +216,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="productionLineNo != null">#{productionLineNo},</if>
             <if test="sliceType != null">#{sliceType},</if>
             <if test="colourNumber != null">#{colourNumber},</if>
+            <if test="taskName != null">#{taskName},</if>
+            <if test="lotNumber != null">#{lotNumber},</if>
+            <if test="onBoardState != null">#{onBoardState},</if>
+            '0'
          </trim>
     </insert>
 
@@ -234,9 +236,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="productAmounts != null">product_amounts = #{productAmounts},</if>
             <if test="productNotes != null">product_notes = #{productNotes},</if>
             <if test="remark != null">remark = #{remark},</if>
-            <if test="createById != null">create_by_id = #{createById},</if>
-            <if test="createBy != null">create_by = #{createBy},</if>
-            <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateById != null">update_by_id = #{updateById},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
@@ -248,6 +247,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="productionLineNo != null">production_line_no = #{productionLineNo},</if>
             <if test="sliceType != null">slice_type = #{sliceType},</if>
             <if test="colourNumber != null">colour_number = #{colourNumber},</if>
+            <if test="taskName != null">task_name = #{taskName},</if>
+            <if test="lotNumber != null">lot_number = #{lotNumber},</if>
+            <if test="onBoardState != null">on_board_state = #{onBoardState},</if>
         </trim>
         where id = #{id}
     </update>
@@ -278,6 +280,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="productionLineNo != null">production_line_no = #{productionLineNo},</if>
             <if test="sliceType != null">slice_type = #{sliceType},</if>
             <if test="colourNumber != null">colour_number = #{colourNumber},</if>
+            <if test="taskName != null">task_name = #{taskName},</if>
+            <if test="lotNumber != null">lot_number = #{lotNumber},</if>
             <if test="onBoardState != null">on_board_state = #{onBoardState},</if>
         </trim>
         where sale_order_no = #{saleOrderNo}
@@ -421,4 +425,65 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="colourNumber != null  and colourNumber != ''"> and colour_number = #{colourNumber}</if>
         <if test="lotNumber != null  and lotNumber != ''"> and lot_number = #{lotNumber}</if>
     </select>
+
+    <insert id="batchInsertSaleProducts" parameterType="java.util.List">
+        INSERT INTO {DBNAME}.sale_products (
+        sale_product_no,
+        sale_order_no,
+        product_no,
+        product_name,
+        product_number,
+        product_weight,
+        product_unit_price,
+        product_amounts,
+        product_notes,
+        remark,
+        create_by_id,
+        create_by,
+        create_time,
+        task_process_key,
+        task_node_key,
+        process_key,
+        status,
+        production_line_no,
+        slice_type,
+        colour_number,
+        task_name,
+        lot_number,
+        on_board_state,
+        del_flag
+        ) VALUES
+        <foreach collection="list" item="item" separator=",">
+            (
+            #{item.saleProductNo},
+            #{item.saleOrderNo},
+            #{item.productNo},
+            #{item.productName},
+            #{item.productNumber},
+            #{item.productWeight},
+            #{item.productUnitPrice},
+            #{item.productAmounts},
+            #{item.productNotes},
+            #{item.remark},
+            #{item.createById},
+            #{item.createBy},
+            #{item.createTime},
+            #{item.taskProcessKey},
+            #{item.taskNodeKey},
+            #{item.processKey},
+            #{item.status},
+            #{item.productionLineNo},
+            #{item.sliceType},
+            #{item.colourNumber},
+            #{item.taskName},
+            #{item.lotNumber},
+            #{item.onBoardState},
+            '0'
+            )
+        </foreach>
+    </insert>
+
+    <select id="selectSaleProductsIdsBySaleNo" parameterType="string" resultType="java.lang.Long">
+        select id from {DBNAME}.sale_products where sale_order_no = #{saleOrderNo} and del_flag = '0'
+    </select>
 </mapper>

+ 5 - 0
zkqy-system/src/main/java/com/zkqy/system/mapper/SysUserMapper.java

@@ -170,4 +170,9 @@ public interface SysUserMapper {
      * @return
      */
     int queryCountTenantUserName(@Param("tenantID") String tenantID, @Param("userName") String userName);
+
+    /**
+     * 根据角色key查询用户信息
+     */
+    List<SysUser> selectUserListByRoleKey(@Param("roleKey") String roleKey,@Param("tenantId") Long tenantId);
 }

+ 8 - 0
zkqy-system/src/main/java/com/zkqy/system/service/ISysUserService.java

@@ -225,4 +225,12 @@ public interface ISysUserService {
      * @return
      */
     boolean isExistUser(String userName);
+
+    /**
+     * 根据角色权限字符查询用户
+     * @param roleKey
+     * @param tenantId
+     * @return
+     */
+    List<SysUser> selectUserListByRoleKey(String roleKey,Long tenantId);
 }

+ 5 - 0
zkqy-system/src/main/java/com/zkqy/system/service/impl/SysUserServiceImpl.java

@@ -526,4 +526,9 @@ public class SysUserServiceImpl implements ISysUserService {
         return false;
     }
 
+    @Override
+    public List<SysUser> selectUserListByRoleKey(String roleKey, Long tenantId) {
+        return userMapper.selectUserListByRoleKey(roleKey, tenantId);
+    }
+
 }

+ 12 - 0
zkqy-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -346,4 +346,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           and del_flag = '0'
     </select>
 
+	<select id="selectUserListByRoleKey" resultMap="SysUserInfoResult">
+		SELECT
+			su.*
+		FROM
+			sys_user_role sur
+				JOIN sys_user su ON sur.user_id = su.user_id
+				JOIN sys_role sr ON sur.role_id = sr.role_id
+		WHERE
+			sr.role_key = #{roleKey}
+		  AND sr.tenant_id = #{tenantId}
+	</select>
+
 </mapper> 

+ 12 - 1
zkqy-ui/src/api/codeListManage/productCodeList.js

@@ -49,10 +49,11 @@ export function delProductCodeList(id) {
 }
 
 // 获取完成产品列表
-export function finishedProductList() {
+export function finishedProductList(params) {
   return request({
     url: '/system/productCodeList/finishedProductList',
     method: 'get',
+    params
     //baseURL: process.env.VUE_APP_BASE_API1
   })
 }
@@ -120,4 +121,14 @@ export function AutoPrinting(data) {
   })
 }
 
+// 删除 打印数据
+export function removeProductCodeASInventory(data) {
+  return request({
+    url: '/system/productCodeList/removeProductCodeASInventory',
+    method: 'delete',
+    //baseURL: process.env.VUE_APP_BASE_API1
+    data: data,
+  })
+}
+
 

+ 11 - 1
zkqy-ui/src/api/system/ProductWarehousingRecord.js

@@ -51,4 +51,14 @@ export function ProductOutboundRecord(query) {
     method: 'get',
     params: query
   })
-}
+}
+
+
+// 删除成品入库记录
+export function deleteProductInventory(data) {
+  return request({
+    url: '/system/ProductInventory/deleteProductInventory',
+    method: 'delete',
+    data: data
+  })
+}

+ 7 - 0
zkqy-ui/src/api/system/customer.js

@@ -50,3 +50,10 @@ export function delCustomer(id) {
     method: 'delete'
   })
 }
+// 获取导入的模板
+export function importTemplate() {
+  return request({
+    url: '/system/customer/importTemplate',
+    method: 'get'
+  })
+}

+ 76 - 3
zkqy-ui/src/api/system/retailMange.js

@@ -9,11 +9,84 @@ export function saleOrderList(params) {
     params: params
   })
 }
+// 查询销售员信息
+export function getRoleUser(roleKey) {
+  return request({
+    url: `/system/user/getRoleUser/${roleKey}`,
+    method: 'get',
+  })
+}
+
+// 查询零售单信息
+export function getRetailOrderInfo(id) {
+  return request({
+    url: `/system/order/getRetailOrderInfo/${id}`,
+    method: 'get',
+  })
+}
+
+// 新增零售订单
+export function addRetailOrder(data) {
+  return request({
+    url: '/system/order/addRetailOrder',
+    method: 'post',
+    data: data
+  })
+}
+// 编辑零售订单
+export function editRetailOrder(data) {
+  return request({
+    url: '/system/order/editRetailOrder',
+    method: 'put',
+    data: data
+  })
+}
+
+// 提交零售单  获取提交详情
+export function retailProductInvoiceInfo(params) {
+  return request({
+    url: '/system/ProductInvoice/productInvoiceInfo',
+    method: 'get',
+    params
+  })
+}
+// 提交零售单  零售单提交
+export function submitRetailOrder(params) {
+  return request({
+    url: '/system/order/submitRetailOrder',
+    method: 'post',
+    data: params
+  })
+}
+// 提交零售单  零售单提交
+export function cancelRetailOrder(params) {
+  return request({
+    url: '/system/order/cancelRetailOrder',
+    method: 'post',
+    data: params
+  })
+}
+// 提交零售单  零售单提交保存
+// export function cancelRetailOrder(params) {
+//   return request({
+//     url: '/system/order/cancelRetailOrder',
+//     method: 'post',
+//     data: params
+//   })
+// }
+// 零售单  出库明细查询
+export function outboundDetails(params) {
+  return request({
+    url: '/system/ProductOutboundRecord/outboundDetails',
+    method: 'get',
+    params
+  })
+}
 
-// 新增角色
-export function addRole(data) {
+// 获取库存箱数
+export function getProductInventory(data) {
   return request({
-    url: '/system/role',
+    url: '/system/ProductInventory/getProductInventory',
     method: 'post',
     data: data
   })

+ 60 - 4
zkqy-ui/src/utils/other.js

@@ -44,7 +44,63 @@ export function inputDisableComplete() {
  * @return {*} 
  */
 export function getDictLabel(value, dictLsit = []) {
-      return dictLsit.find((item) => {
-        return item.value == value;
-      })?.label;
-}
+  return dictLsit.find((item) => {
+    return item.value == value;
+  })?.label;
+}
+
+export class numToCapital {
+  uppercase(num) {
+    let minus = "";
+    let m_str = "";
+    const text = num.toString();
+    const zh = '零壹贰叁肆伍陆柒捌玖';
+    if (text.indexOf("-") === 0) {
+      num = text.replace("-", "");
+      minus = "负"
+    }
+    let money_num = Number(num);
+    let money = Math.round(money_num * 100).toString(10);
+    const len = money.length;
+    for (let i = 0; i < len; i++) {
+      m_str = m_str + zh.charAt(parseInt(money.charAt(i))) + this.sitToUnit(len - i - 1)
+    }
+    m_str = m_str.replace("零分", "");
+    m_str = m_str.replace("零角", "零");
+    let yy = 0;
+    while (true) {
+      let len = m_str.length;
+      m_str = m_str.replace("零圆", "圆");
+      m_str = m_str.replace("零万", "万");
+      m_str = m_str.replace("零亿", "亿");
+      m_str = m_str.replace("零仟", "零");
+      m_str = m_str.replace("零佰", "零");
+      m_str = m_str.replace("零零", "零");
+      m_str = m_str.replace("零拾", "零");
+      m_str = m_str.replace("亿万", "亿零");
+      m_str = m_str.replace("万仟", "万零");
+      m_str = m_str.replace("仟佰", "仟零");
+      yy = m_str.length;
+      if (yy === len) {
+        break
+      }
+    }
+    yy = m_str.length;
+    if (m_str.charAt(yy - 1) === "零") {
+      m_str = m_str.substring(0, yy - 1)
+    }
+    yy = m_str.length;
+    if (m_str.charAt(yy - 1) === "圆") {
+      m_str = m_str + "整"
+    }
+    return minus + m_str
+  }
+  sitToUnit(a) {
+    if (a > 10) {
+      a = a - 8;
+      return (this.sitToUnit(a))
+    }
+    const zh = '分角圆拾佰仟万拾佰仟亿';
+    return zh.charAt(a)
+  }
+}

+ 8 - 7
zkqy-ui/src/utils/print/codeListPrint.js

@@ -44,35 +44,36 @@ function codeListPrint(data, domId) {
       directionOfTwist,//捻向
       qrCodeData,
       boxNum,//箱号
-      packaging
+      packaging,
+      qrCodeId,
     } = item
     // let theNumber = Number(printFormat) //小包装:1  大包装:2
     let theNumber = packaging == 3 ? 2 : 1;  //车丝和小包装都是1  大包装是2
 
     console.log(theNumber);
     // 循环打印
-    let uuid = uuidv4().slice(0, 8);
+    // let uuid = uuidv4().slice(0, 8);
     while (theNumber > 0) {
       theNumber--;
       res += (printFormat == 3 ? '' : preHtml);
       // let qrCodeData = '123456';
       // let temp = id + '@' + uuid + '@' + canisterNum + '@' + suttle + '@' + grossWeight + '@' + lotNum + '@' + productName + '@' + productSpecifications + '@' + productColor + '@' + levels + '@' + qrCode + '@' + boxNum
-      let temp = id + '@' + uuid + '@' + canisterNum + '@' + suttle + '@' + grossWeight + '@' + qrCode
+      let temp = id + '@' + qrCodeId + '@' + canisterNum + '@' + suttle + '@' + grossWeight + '@' + qrCode
       // let resStr = encodeURIComponent(temp)
       if (printFormat == 3) {//打印英文版
         uuidList.push({
-          id: uuid + '' + theNumber,
+          id: qrCodeId + '' + theNumber,
           qrCodeData: temp,//id uuid 筒数 净重 毛重 批次 品种 规格 色号 等级 码单号 箱号 
           size: 180,
         })
-        res = printEN(uuid + '' + theNumber, item, res)
+        res = printEN(qrCodeId + '' + theNumber, item, res)
       } else {//打印中文版
         uuidList.push({
-          id: uuid + '' + theNumber,
+          id: qrCodeId + '' + theNumber,
           qrCodeData: temp,//id uuid 筒数 净重 毛重 批次 品种 规格 色号 等级 码单号 箱号
           size: 120,
         })
-        res = printCN(uuid + '' + theNumber, item, res) + endHtml;
+        res = printCN(qrCodeId + '' + theNumber, item, res) + endHtml;
       }
     }
   }

+ 22 - 10
zkqy-ui/src/utils/print/outBoundPrint.js

@@ -1,4 +1,4 @@
-function outBoundPrint(data, domId) {
+function outBoundPrint(data, domId, isRetail = false) {
   console.log(data);
   let { outStockDate, remark, unitName, printUser } = data.form
   let { tableData } = data
@@ -13,6 +13,24 @@ function outBoundPrint(data, domId) {
   if (dd < 10) {
     dd = "0" + dd;
   }
+  let tableHeader = ``
+  if (isRetail) { //零售
+    tableHeader = `<td style="width: 100px;">名称</td>
+        <td style="width: 100px;">规格</td>
+        <td style="width: 100px;">单位</td>
+        <td style="width: 100px;">数量</td>
+        <td style="width: 100px;">单价</td>
+        <td style="width: 100px;">金额</td>`
+
+  } else {
+    tableHeader = `<td style="width: 100px;">名称</td>
+        <td style="width: 100px;">规格</td>
+        <td style="width: 100px;">批号</td>
+        <td style="width: 100px;">单位</td>
+        <td style="width: 100px;">数量</td>
+        <td style="width: 100px;">单价</td>
+        <td style="width: 100px;">金额</td>`
+  }
 
   let printContent = `<div style="width: 700px;position: relative;">
 
@@ -29,13 +47,7 @@ function outBoundPrint(data, domId) {
     </div>
     <table style="width: 100%;border-collapse:collapse;" cellpadding="10" border="1">
       <tr style="text-align: center;">
-        <td style="width: 100px;">名称</td>
-        <td style="width: 100px;">规格</td>
-        <td style="width: 100px;">批号</td>
-        <td style="width: 100px;">单位</td>
-        <td style="width: 100px;">数量</td>
-        <td style="width: 100px;">单价</td>
-        <td style="width: 100px;">金额</td>
+        ${tableHeader}
       </tr>`;
   let totalPrice = 0, totalWeight = 0;
   for (let i = 0; i < tableData.length; i++) {
@@ -50,7 +62,7 @@ function outBoundPrint(data, domId) {
     printContent += `<tr style="text-align: center;">
       <td>${productName}</td>
       <td>${productSpecifications}</td>
-      <td>${lotNumber}</td>
+      ${isRetail ? '' : '<td>' + lotNumber + '</td>'}
       <td>${unit}</td>
       <td>${productNumber}</td>
       <td>${productUnitPrice}</td>
@@ -62,7 +74,7 @@ function outBoundPrint(data, domId) {
   printContent += `<tr style="text-align: center;border: none;">
         <td style="width: 100px;">合计</td>
         <td style="width: 100px;"></td>
-        <td style="width: 100px;"></td>
+        ${isRetail ? '' : '<td style="width: 100px;"></td>'}
         <td style="width: 100px;"></td>
         <td style="width: 100px;">${totalWeight}</td>
         <td style="width: 100px;"></td>

+ 1 - 1
zkqy-ui/src/views/bussiness/processMange_line.vue

@@ -49,7 +49,7 @@
                 v-for="(item, index) in productLineList"
                 :key="index"
                 :label="item.productionLineName"
-                :value="item.productionLineNo"
+                :value="item.id"
               >
                 <span class="discribe" style="float: left">{{
                   item.productionLineName

+ 51 - 6
zkqy-ui/src/views/orderMange/components/dialogForm/OutBound.vue

@@ -46,14 +46,18 @@
         </el-col>
       </el-form>
     </el-row>
-    <el-table :data="tableData" border stripe>
+    <el-table ref="tableRef" v-if="tableShow" :data="tableData" border stripe>
       <el-table-column type="index" width="50" />
       <el-table-column label="名称" prop="productName"></el-table-column>
       <el-table-column
         label="规格"
         prop="productSpecifications"
       ></el-table-column>
-      <el-table-column label="批号" prop="lotNumber"></el-table-column>
+      <el-table-column
+        v-if="!isRetail"
+        label="批号"
+        prop="lotNumber"
+      ></el-table-column>
       <el-table-column label="单位" prop="unit">
         <template slot-scope="scope">
           <el-input
@@ -64,7 +68,10 @@
           ></el-input>
         </template>
       </el-table-column>
-      <el-table-column label="数量" prop="productNumber"></el-table-column>
+      <el-table-column
+        :label="isRetail ? '箱数' : '数量'"
+        prop="productNumber"
+      ></el-table-column>
       <el-table-column label="单价" prop="productUnitPrice"></el-table-column>
       <el-table-column label="金额" prop="productAmounts"></el-table-column>
     </el-table>
@@ -82,6 +89,8 @@ export default {
   components: {},
   data() {
     return {
+      isRetail: false,
+      tableShow: true,
       form: {
         unitName: "",
         remark: "",
@@ -93,10 +102,43 @@ export default {
         // ],
       },
       tableData: [],
-      columns: [],
+      columns: [
+        {
+          prop: "productName",
+          label: "名称",
+        },
+        {
+          prop: "productSpecifications",
+          label: "规格",
+        },
+        {
+          prop: "lotNumber",
+          label: "批号",
+        },
+        {
+          prop: "unit",
+          label: "单位",
+        },
+        {
+          prop: "productName",
+          label: "名称",
+        },
+        {
+          prop: "productName",
+          label: "名称",
+        },
+      ],
     };
   },
   computed: {},
+  watch: {
+    isRetail(val) {
+      console.log(val);
+      this.$nextTick(() => {
+        this.$refs.tableRef.doLayout();
+      });
+    },
+  },
   methods: {
     // 重置表单
     resetForm() {
@@ -107,14 +149,16 @@ export default {
       });
     },
     // 获取表格数据
-    async getTableData(row) {
+    async getTableData(row, isRetail = true) {
       this.resetForm();
       this.row = row;
+
       console.log(row);
       try {
         let payload = {
-          saleOrderNo: row.saleOrderSaleNo,
+          saleOrderNo: row.saleOrderSaleNo || row.saleNo,
         };
+        console.log(payload);
         let res = await outboundOrderInfo(payload);
         if (res.code == 200) {
           res.data.forEach((item) => {
@@ -128,6 +172,7 @@ export default {
             item.unit = "";
           });
           this.tableData = res.data;
+          this.isRetail = isRetail;
         }
       } catch (error) {}
     },

+ 106 - 0
zkqy-ui/src/views/orderMange/components/dialogForm/OutStock.vue

@@ -0,0 +1,106 @@
+<template>
+  <div class="table-container">
+    <el-table
+      :data="tableData"
+      border
+      stripe
+      :summary-method="getSummaries"
+      show-summary
+    >
+      <el-table-column type="index" width="50" />
+      <el-table-column prop="productName" label="品名"> </el-table-column>
+      <el-table-column prop="productSpecifications" label="规格">
+      </el-table-column>
+      <el-table-column prop="productColor" label="色泽"> </el-table-column>
+      <el-table-column prop="lotNum" label="批号"> </el-table-column>
+      <el-table-column prop="levels" label="等级"> </el-table-column>
+      <el-table-column prop="grossWeight" label="毛重"> </el-table-column>
+      <el-table-column prop="suttle" label="净重"> </el-table-column>
+      <el-table-column prop="qrCode" label="码单号"> </el-table-column>
+      <el-table-column prop="boxNum" label="箱号"> </el-table-column>
+    </el-table>
+  </div>
+</template>
+
+<script>
+import { outboundDetails } from "@/api/system/retailMange.js";
+import moment from "moment";
+export default {
+  name: "OutStock",
+  props: [],
+  components: {},
+  data() {
+    return {
+      tableData: [],
+    };
+  },
+  computed: {},
+  methods: {
+    // 自定义的小计计算方法
+    getSummaries(param) {
+      const { columns, data } = param;
+      const sums = [];
+      columns.forEach((column, index) => {
+        if (index === 5) {
+          sums[index] = "小计:";
+          return;
+        }
+        const values = data.map((item) => Number(item[column.property]));
+        if (
+          index === 0 ||
+          index === 1 ||
+          index === 2 ||
+          index === 3 ||
+          index === 4 ||
+          index === 8 ||
+          index === 9
+        ) {
+          sums[index] = "";
+        } else if (!values.every((value) => isNaN(value))) {
+          sums[index] = values
+            .reduce((prev, curr) => {
+              const value = Number(curr);
+              if (!isNaN(value)) {
+                return prev + curr;
+              } else {
+                return prev;
+              }
+            }, 0)
+            ?.toFixed(2);
+          console.log(sums[index], index);
+        } else {
+          sums[index] = "N/A";
+        }
+      });
+
+      return sums;
+    },
+    // 事件格式化工具
+    formatTime(time) {
+      // typeof time === "string" ? (time = new Date(time)) : time;
+      return moment(time).format("YYYY-MM-DD");
+    },
+    // 获取出库详情
+    async getOutStockDetail(row) {
+      console.log(row);
+      let { saleNo } = row;
+      try {
+        let payLoad = {
+          saleOrderNo: saleNo,
+        };
+        let res = await outboundDetails(payLoad);
+        if (res.code == 200) {
+          console.log(res);
+          this.tableData = res.data;
+        } else {
+          this.$message.error(res.msg);
+        }
+      } catch (error) {
+        console.log(error);
+      }
+    },
+  },
+};
+</script>
+
+<style scoped lang="scss"></style>

+ 492 - 0
zkqy-ui/src/views/orderMange/components/dialogForm/RetailProvide.vue

@@ -0,0 +1,492 @@
+<template>
+  <div class="form-wrap">
+    <div class="title"><span>诸暨市新丝维纤维有限公司销售开单</span></div>
+    <el-row :gutter="20">
+      <el-form
+        ref="form"
+        :model="form"
+        :rules="rules"
+        label-width="100px"
+        class="form"
+        :inline="true"
+      >
+        <el-col :span="24">
+          <el-form-item prop="noticeNumber" label="通知单号:" size="mini">
+            {{ form.noticeNumber }}
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="通知日期:" prop="noticeDate" size="mini">
+            <!-- <el-date-picker
+              v-model="form.noticeDate"
+              type="date"
+              size="mini"
+              placeholder="选择日期"
+            >
+            </el-date-picker> -->
+            {{ form.noticeDate }}
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="销售员:" prop="salesman" size="mini">
+            <!-- <el-input
+              v-model="form.salesman"
+              placeholder=""
+              size="mini"
+              clearable
+            ></el-input> -->
+            {{ form.salesman }}
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="当前库存:" size="mini">
+            {{ "箱数: " + form.inventoryBoxNum }}
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="开票员:" prop="drawer" size="mini">
+            {{ form.drawer }}
+            <!-- <el-input
+              v-model="form.drawer"
+              placeholder=""
+              size="mini"
+              clearable
+            ></el-input> -->
+
+            <!-- <el-select
+              width="100px"
+              v-model="form.drawer"
+              placeholder=""
+              clearable
+              filterable
+            >
+              <el-option
+                v-for="item in []"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              >
+              </el-option>
+            </el-select> -->
+          </el-form-item>
+        </el-col>
+
+        <!-- <el-divider direction="horizontal" content-position="center"
+          >11111</el-divider
+        > -->
+
+        <el-col :span="8">
+          <el-form-item label="客户名称" size="mini">
+            {{ form.customName }}
+            <!-- <el-select
+              v-model="form.customerId"
+              placeholder=""
+              clearable
+              filterable
+            >
+              <el-option
+                v-for="item in customerOptions"
+                :key="item.id"
+                :label="item.customName"
+                :value="item.id"
+              >
+              </el-option>
+            </el-select> -->
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="备 注:" prop="dispatchNoteRemark" size="mini">
+            <el-input
+              v-model="form.dispatchNoteRemark"
+              placeholder=""
+              size="mini"
+              clearable
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="货车登记:" prop="truckRegistration" size="mini">
+            <el-input
+              v-model="form.truckRegistration"
+              placeholder=""
+              size="mini"
+              clearable
+            ></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="开票类型:" prop="billingType" size="mini">
+            <!-- <el-select
+              v-model="form.billingType"
+              placeholder=""
+              clearable
+              filterable
+            >
+              <el-option
+                v-for="item in dict.type.billing_type"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              >
+              </el-option>
+            </el-select> -->
+            {{ "一类开票" }}
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="单据类型:" prop="documentType" size="mini">
+            <!-- <el-select
+              v-model="form.documentType"
+              placeholder=""
+              clearable
+              filterable
+            >
+              <el-option
+                v-for="item in dict.type.document_type"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              >
+              </el-option>
+            </el-select> -->
+            销售
+          </el-form-item>
+        </el-col>
+      </el-form>
+    </el-row>
+    <el-table
+      show-summary
+      :data="tableData"
+      :summary-method="getSummaries"
+      @cell-click="cellClick"
+      border
+      stripe
+    >
+      <el-table-column
+        v-for="(col, index) in columns"
+        :prop="col.id"
+        :key="index"
+        :label="col.label"
+      >
+      </el-table-column>
+      <el-table-column label="备注" prop="productRemark">
+        <!-- <template slot-scope="scope">
+          <el-input
+            v-model="scope.row.productRemark"
+            size="mini"
+            clearable
+          ></el-input>
+        </template> -->
+      </el-table-column>
+    </el-table>
+  </div>
+</template>
+
+<script>
+import {
+  productInvoiceInfo,
+  queryDropDownBoxData,
+} from "@/api/tablelist/commonTable";
+import {
+  retailProductInvoiceInfo,
+  getProductInventory,
+} from "@/api/system/retailMange.js";
+import { mapState } from "vuex";
+import moment from "moment";
+export default {
+  name: "RetailProvide",
+  props: ["currentRow"],
+  dicts: ["billing_type", "document_type"],
+  components: {},
+  data() {
+    return {
+      isEdit: false,
+      customerOptions: [], //客户选项
+      form: {
+        noticeNumber: "", //通知单号
+        noticeDate: "", //通知日期
+        salesman: "", //销售员
+        customerId: "", //客户编号
+        drawer: "", //开票员
+        dispatchNoteRemark: "", //发货单备注
+        billingType: "", //开票类型
+        truckRegistration: "", //货车登记
+        documentType: "", //单据类型
+        sellingUnit: "", //售货单位
+        auditOpinion: "", //审核意见
+        inventoryBoxNum: "", //库存箱数
+        inventoryWeight: "", //库存重量
+
+        batchNumberType: 1, //批次类型
+        computeType: 1, //计算方式
+      },
+      rules: {},
+      tableData: [
+        {
+          // productCode: "", //编码
+          // productName: "", //品名
+          // productSpecifications: "", //规格
+          // lotNum: "", //批号
+          // levels: "", //等级
+          // boxNum: "", //箱数
+          // weight: "", //重量
+          // unitPrice: "", //单价
+          // saleAmount: "", //销售金额
+          // productColor: "", //色泽
+          // productType: "", //类型
+          // bottomPrice: "", //底价
+          // productRemark: "", //备注
+        },
+      ],
+      columns: [
+        {
+          id: "productCode",
+          label: "编码",
+        },
+        {
+          id: "productName",
+          label: "品名",
+        },
+        {
+          id: "productSpecifications",
+          label: "规格",
+        },
+        // {
+        //   id: "lotNum",
+        //   label: "批号",
+        // },
+        // {
+        //   id: "levels",
+        //   label: "等级",
+        // },
+        {
+          id: "actualWeight",
+          label: "箱数",
+        },
+        // {
+        //   id: "weight",
+        //   label: "重量",
+        // },
+        {
+          id: "unitPrice",
+          label: "单价",
+        },
+        {
+          id: "saleAmount",
+          label: "销售金额",
+        },
+        {
+          id: "productColor",
+          label: "色泽",
+        },
+        {
+          id: "productType",
+          label: "类型",
+        },
+        {
+          id: "unitPrice",
+          label: "底价",
+        },
+      ],
+    };
+  },
+  computed: {
+    ...mapState({
+      username: (state) => state.user.name,
+    }),
+  },
+  methods: {
+    // 自定义合计方法
+    getSummaries(param) {
+      const { columns, data } = param;
+      const sums = [];
+      columns.forEach((column, index) => {
+        if (index === 0) {
+          sums[index] = "合计";
+          return;
+        }
+        const values = data.map((item) => Number(item[column.property]));
+        if (!values.every((value) => isNaN(value))) {
+          if (index == 3 || index == 4 || index == 5) {
+            sums[index] = values.reduce((prev, curr) => {
+              const value = Number(curr);
+              if (!isNaN(value)) {
+                return prev + curr;
+              } else {
+                return prev;
+              }
+            }, 0);
+          } else {
+            sums[index] = "";
+          }
+        } else {
+          sums[index] = "";
+        }
+      });
+      console.log(sums);
+      return sums;
+    },
+    // 初始化下拉框数据
+    async initDropDownBoxData() {
+      try {
+        let res = await queryDropDownBoxData([
+          {
+            basicMap: {
+              tableName: "customer",
+            },
+          },
+        ]);
+        if (res.code == 200) {
+          console.log(res);
+          this.customerOptions = res.data.resultMap.customer;
+        } else {
+          throw new Error(res);
+        }
+      } catch (error) {
+        console.log(error);
+      }
+    },
+    // 单号生成
+    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 productInvoiceInfo(row) {
+      // 获取下拉框数据
+      await this.initDropDownBoxData();
+      let { saleNo, saleDate, salesman, customName } = row;
+      console.log(row);
+      let payload = {
+        saleOrderNo: saleNo,
+      };
+
+      let res = await retailProductInvoiceInfo(payload);
+      if (res.code == 200) {
+        this.tableData = res.data.saleProductInfoList;
+        this.tableData.forEach((item) => {
+          // item.saleOrderNo = saleOrderSaleNo;
+          let { boxNum, actualWeight, unitPrice } = item;
+          item.saleAmount = (Number(actualWeight) * Number(unitPrice)).toFixed(
+            2
+          );
+        });
+        // 表单字段循环赋值
+        // for (const key of Object.keys(this.form)) {
+        //   this.form[key] = res.data[key];
+        // }
+        // 初始化表单数据  start
+        this.form.customName = customName;
+        this.form.customerId = res.data.customerId;
+        this.form.noticeDate = moment(new Date()).format("YYYY-MM-DD");
+        this.form.salesman = salesman;
+        this.form.drawer = this.username;
+        this.form.documentType = "1";
+        this.form.billingType = "1";
+        this.form.saleOrderNo = saleNo;
+        this.form.inventoryBoxNum = res.data.inventoryBoxNum;
+        console.log(this.form);
+        this.form.dispatchNoteRemark = res.data.dispatchNoteRemark || "";
+        this.form.truckRegistration = res.data.truckRegistration || "";
+
+        // 初始化表单数据  end
+        this.form.inventoryWeight = Number(this.form.inventoryWeight)?.toFixed(
+          2
+        );
+        this.isEdit = res.data.id ? true : false;
+        if (!this.isEdit) {
+          this.form.drawer = this.username;
+          this.form.noticeNumber = this.getOrderNo();
+
+          this.form.status = 1;
+        } else {
+          this.form.noticeNumber = res.data.noticeNumber;
+          this.form.id = res.data.id;
+          this.form.dispatchNoteRemark = res.data.dispatchNoteRemark;
+          this.form.truckRegistration = res.data.truckRegistration;
+        }
+        this.form.batchNumberType = 1;
+        this.form.computeType = 1;
+      } else {
+        console.log(res);
+      }
+    },
+    // 表格点击获取数据
+    async cellClick(row, column, cell, event) {
+      console.log(row);
+      let { productId } = row;
+      try {
+        let payLoad = {
+          productId,
+        };
+        let res = await getProductInventory(payLoad);
+        if (res.code == 200) {
+          this.form.inventoryBoxNum = res.data.inventoryBoxNum;
+        } else {
+          console.log(res);
+        }
+      } catch (error) {
+        console.log(error);
+      }
+    },
+
+    // 获取表单数据
+    getAllData() {
+      let res = {};
+      this.$refs.form.validate(async (valid) => {
+        console.log(valid);
+        if (valid) {
+          res = {
+            flag: true,
+            isEdit: this.isEdit,
+            data: {
+              formData: this.form,
+              tableData: this.tableData,
+            },
+          };
+        } else {
+          res = {
+            flag: false,
+          };
+        }
+      });
+      return res;
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.form-wrap {
+  width: 100%;
+  .title {
+    display: flex;
+    justify-content: center;
+    font-size: 20px;
+    font-weight: 700;
+  }
+}
+</style>

+ 102 - 0
zkqy-ui/src/views/orderMange/customerMange/index.vue

@@ -1,5 +1,48 @@
 <template>
   <div class="app-container">
+    <!-- 导入弹窗 start-->
+    <el-dialog
+      :title="upload.title"
+      :visible.sync="upload.open"
+      width="400px"
+      append-to-body
+    >
+      <el-upload
+        ref="upload"
+        :limit="1"
+        accept=".xlsx, .xls"
+        :headers="upload.headers"
+        :action="upload.url"
+        v-loading="upload.isUploading"
+        :disabled="upload.isUploading"
+        :on-progress="handleFileUploadProgress"
+        :on-success="handleFileSuccess"
+        :auto-upload="false"
+        drag
+      >
+        <i class="el-icon-upload"></i>
+        <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
+        <div class="el-upload__tip text-center" slot="tip">
+          <!--          <div class="el-upload__tip" slot="tip">-->
+          <!--            <el-checkbox v-model="upload.updateSupport"/>-->
+          <!--            是否更新已经存在的用户数据-->
+          <!--          </div>-->
+          <span>仅允许导入xls、xlsx格式文件。</span>
+          <el-link
+            type="primary"
+            :underline="false"
+            style="font-size: 12px; vertical-align: baseline"
+            @click="importTemplate"
+            >下载模板
+          </el-link>
+        </div>
+      </el-upload>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitFileForm">确 定</el-button>
+        <el-button @click="upload.open = false">取 消</el-button>
+      </div>
+    </el-dialog>
+    <!-- 导入弹窗 end-->
     <el-form
       :model="queryParams"
       ref="queryForm"
@@ -66,6 +109,17 @@
           >删除</el-button
         >
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          @click="upload.open = true"
+          v-hasPermi="['system:customer:IMPORT']"
+          >导入</el-button
+        >
+      </el-col>
       <el-col :span="1.5">
         <el-button
           type="warning"
@@ -333,6 +387,7 @@ import {
   updateCustomer,
   checkCustomerNo,
 } from "@/api/system/customer";
+import { getToken } from "@/utils/auth";
 
 export default {
   name: "Customer",
@@ -381,12 +436,59 @@ export default {
           { required: true, message: "手机号不能为空", trigger: "blur" },
         ],
       },
+      // excel共通导入数据
+      upload: {
+        // 是否显示弹出层
+        open: false,
+        // 弹出层标题(
+        title: "",
+        // 是否禁用上传
+        isUploading: false,
+        // 是否更新已经存在的数据
+        updateSupport: 0,
+        // 设置上传的请求头部
+        headers: { Authorization: "Bearer " + getToken() },
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API1 + "system/customer/importData",
+      },
     };
   },
   created() {
     this.getList();
   },
   methods: {
+    // 文件上传成功处理
+    handleFileSuccess(response, file, fileList) {
+      this.upload.open = false;
+      this.upload.isUploading = false;
+      this.$refs.upload.clearFiles();
+      this.$alert(
+        "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
+          response.msg +
+          "</div>",
+        "导入结果",
+        { dangerouslyUseHTMLString: true }
+      );
+      this.getList();
+    },
+    // 文件上传中处理
+    handleFileUploadProgress(event, file, fileList) {
+      this.upload.isUploading = true;
+    },
+    /** 下载模板操作 */
+    importTemplate() {
+      this.download(
+        "system/customer/importTemplate",
+        {},
+        `customer_template_${new Date().getTime()}.xlsx`
+      );
+    },
+    // 提交上传文件
+    submitFileForm() {
+      this.$refs.upload.submit();
+      this.upload.open = false;
+      this.getList();
+    },
     // 校验客户编码
     async checkCustomerNoHandler(rule, value, callback) {
       try {

+ 91 - 11
zkqy-ui/src/views/orderMange/index.vue

@@ -146,9 +146,6 @@
           align="center"
         >
         </el-table-column>
-        <!-- <span v-for="(key, val) in columns" :key="key">
-        <el-table-column :label="key" align="center" :prop="val" />
-      </span> -->
         <el-table-column
           v-for="item in columns"
           :key="item.key"
@@ -530,11 +527,12 @@
             >
             <el-col :span="12">
               <el-form-item label-width="120px" label="合计金额(大写)">
-                <el-input
+                <!-- <el-input
                   v-model="formData.saleAmountInWords"
                   size="small"
                   clearable
-                ></el-input>
+                ></el-input> -->
+                {{ formData.saleAmountInWords }}
               </el-form-item>
             </el-col>
             <el-col :span="12">
@@ -736,6 +734,15 @@
           >
         </span>
       </el-dialog>
+      <!-- 出库明细 -->
+      <el-dialog title="出库明细" :visible.sync="outStockShow" width="1200px">
+        <OutStock ref="outStockRef"></OutStock>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="outStockShow = false">关 闭</el-button>
+          <!-- <el-button @click="btnSave">保 存</el-button> -->
+          <!-- <el-button type="primary" @click="btnComfirm">确 定</el-button> -->
+        </span>
+      </el-dialog>
       <div id="printDom"></div>
     </div>
   </el-card>
@@ -779,12 +786,16 @@ import Deliver from "@/views/orderMange/components/dialogForm/Deliver.vue";
 import OutBound from "@/views/orderMange/components/dialogForm/OutBound.vue";
 import outBoundPrint from "@/utils/print/outBoundPrint";
 import { listCustomer } from "@/api/system/customer";
+import OutStock from "@/views/orderMange/components/dialogForm/OutStock.vue";
+import { numToCapital } from "@/utils/other";
 export default {
   name: "listInfo",
   dicts: ["payment_method", "direction_of_twist"],
-  components: { Queryfrom, Menu, DialogTemplate, Deliver, OutBound },
+  components: { Queryfrom, Menu, DialogTemplate, Deliver, OutBound, OutStock },
   data() {
     return {
+      totalMoney: "", //总金额 小写
+      outStockShow: false, //出库详情
       selection: [], //勾选的数据
       // 出库单 start
       outBoundShow: false,
@@ -1030,7 +1041,20 @@ export default {
     // 得到当前展示的table的唯一标识
     this.tableKey = this.$route.query.tableKey;
   },
-  watch: {},
+  watch: {
+    totalMoney: {
+      handler(newVal, oldVal) {
+        if (isNaN(Number(newVal))) {
+          this.formData.saleAmountInWords = "零";
+        } else {
+          const ntc = new numToCapital();
+          this.formData.saleAmountInWords = ntc.uppercase(newVal);
+        }
+      },
+      deep: true,
+      immediate: true,
+    },
+  },
   async mounted() {
     await this.getDropDownData();
   },
@@ -1080,7 +1104,7 @@ export default {
       this.currentRow = row;
       this.outBoundShow = true;
       this.$nextTick(() => {
-        this.$refs.outBoundRef.getTableData(row);
+        this.$refs.outBoundRef.getTableData(row, false);
       });
     },
     // 出库单打印回调
@@ -1089,7 +1113,7 @@ export default {
       console.log(res);
       if (res.flag) {
         res.data.form.printUser = this.nickName;
-        outBoundPrint(res.data, "printDom");
+        outBoundPrint(res.data, "printDom", false);
       }
     },
 
@@ -1186,7 +1210,9 @@ export default {
               return prev;
             }
           }, 0);
-          sums[index];
+          if (index == 4) {
+            this.totalMoney = sums[index];
+          }
         } else {
           sums[index] = "N/A";
         }
@@ -1364,6 +1390,15 @@ export default {
               btnHasPermi: "huaxian:xsglddgl:INSERT",
               children: [],
             },
+            {
+              btnName: "出库明细",
+              btnType: "OutDetail",
+              btnIcon: "",
+              btnShowCondition:
+                '[{"fieldName":"sale_order.status","mark":"3","refValue":"1"}]',
+              btnHasPermi: "huaxian:xsglddgl:INSERT",
+              children: [],
+            },
             {
               btnName: "打印出库单",
               btnType: "printOutBound",
@@ -1523,11 +1558,45 @@ export default {
         callback(new Error("校验失败,请稍后再试"));
       }
     },
+    // 校验表格数据
+    validateTableData() {
+      if (this.productionTableData.length == 0) {
+        return {
+          res: false,
+          msg: "请添加货品明细",
+        };
+      }
+      let res = this.productionTableData.every((item) => {
+        return (
+          item.productNo &&
+          item.productNumber &&
+          item.productUnitPrice &&
+          item.productAmounts &&
+          item.sliceType &&
+          item.colourNumber
+        );
+      });
+      if (!res) {
+        return {
+          res: false,
+          msg: "请填写完整货品明细",
+        };
+      }
+      return {
+        res: true,
+        msg: "",
+      };
+    },
     // 审计   提交编辑结果按钮回调
     async editConfirm() {
       this.$refs.formDataRef.validate(async (valid) => {
         if (valid) {
           console.log(valid);
+          let tableValidate = this.validateTableData();
+          if (!tableValidate.res) {
+            this.$message.warning(tableValidate.msg);
+            return;
+          }
           let {
             id,
             //订单表数据
@@ -1786,7 +1855,7 @@ export default {
 
           await this.getDropDownData();
           this.productionTableData = sale_products.map((item) => {
-            item.productType = this.productionOptions.find(
+            item.productType = this.allProductionOptions.find(
               (i) => item.productNo == i.productNo
             )?.productType;
             return item;
@@ -3058,6 +3127,13 @@ export default {
         this.$refs.deliverRef.productInvoiceInfo(row);
       });
     },
+    // 出库详情回调
+    handleOutDetail(row) {
+      this.outStockShow = true;
+      this.$nextTick(() => {
+        this.$refs.outStockRef.getOutStockDetail(row, false);
+      });
+    },
 
     // 操作列回调
     excuteHandler(btnData, row) {
@@ -3092,6 +3168,10 @@ export default {
         case "myEdit":
           this.handleEdit("1", row);
           break;
+        case "OutDetail":
+          this.handleOutDetail(row);
+          break;
+
         case "myDetail":
           this.handleDetail(row);
           break;

+ 32 - 22
zkqy-ui/src/views/orderMange/productInRecord/index.vue

@@ -60,11 +60,11 @@
           icon="el-icon-search"
           size="mini"
           @click="handleQuery"
-          >搜索</el-button
-        >
+          >搜索
+        </el-button>
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
-          >重置</el-button
-        >
+          >重置
+        </el-button>
       </el-form-item>
     </el-form>
 
@@ -126,6 +126,7 @@
       <!-- <el-table-column type="selection" width="55" align="center" /> -->
       <!-- <el-table-column label="序号" type="index" align="center" /> -->
       <el-table-column label="码单号" align="center" prop="qrCode" />
+      <!-- <el-table-column label="箱号" align="center" prop="boxNum"/> -->
       <el-table-column label="品名" align="center" prop="productName" />
       <el-table-column
         label="规格"
@@ -188,9 +189,8 @@
         </template>
       </el-table-column>
       <el-table-column label="入库人" align="center" prop="depositor" />
-      <el-table-column label="备注" align="center" prop="remark" />
+      <!-- <el-table-column label="备注" align="center" prop="remark"/> -->
       <el-table-column
-        v-if="false"
         label="操作"
         align="center"
         class-name="small-padding fixed-width"
@@ -201,16 +201,17 @@
               操作<i class="el-icon-arrow-down el-icon--right"></i>
             </el-button>
             <el-dropdown-menu slot="dropdown">
-              <el-dropdown-item>
-                <el-button
-                  size="mini"
-                  type="text"
-                  icon="el-icon-edit"
-                  @click="handleUpdate(scope.row)"
-                  v-hasPermi="['system:ProductWarehousingRecord:edit']"
-                  >修改</el-button
-                >
-              </el-dropdown-item>
+              <!--              <el-dropdown-item>-->
+              <!--                <el-button-->
+              <!--                  size="mini"-->
+              <!--                  type="text"-->
+              <!--                  icon="el-icon-edit"-->
+              <!--                  @click="handleUpdate(scope.row)"-->
+              <!--                  v-hasPermi="['system:ProductWarehousingRecord:edit']"-->
+              <!--                >修改-->
+              <!--                </el-button-->
+              <!--                >-->
+              <!--              </el-dropdown-item>-->
               <el-dropdown-item>
                 <el-button
                   size="mini"
@@ -218,8 +219,8 @@
                   icon="el-icon-delete"
                   @click="handleDelete(scope.row)"
                   v-hasPermi="['system:ProductWarehousingRecord:remove']"
-                  >删除</el-button
-                >
+                  >删除
+                </el-button>
               </el-dropdown-item>
             </el-dropdown-menu>
           </el-dropdown>
@@ -359,6 +360,7 @@ import {
   delProductWarehousingRecord,
   addProductWarehousingRecord,
   updateProductWarehousingRecord,
+  deleteProductInventory,
 } from "@/api/system/ProductWarehousingRecord";
 import { getDictLabel } from "@/utils/other";
 
@@ -535,17 +537,25 @@ export default {
     },
     /** 删除按钮操作 */
     handleDelete(row) {
-      const ids = row.id || this.ids;
+      // const ids = row.id || this.ids;
       this.$modal
-        .confirm('是否确认删除成品入库记录编号为"' + ids + '"的数据项?')
+        .confirm(
+          '是否确认删除码单号为"' +
+            row.qrCode +
+            "箱号为:" +
+            row.boxNum +
+            '"的数据项?'
+        )
         .then(function () {
-          return delProductWarehousingRecord(ids);
+          return deleteProductInventory(row);
         })
         .then(() => {
           this.getList();
           this.$modal.msgSuccess("删除成功");
         })
-        .catch(() => {});
+        .catch(() => {
+          this.$modal.msgError("删除失败!请检查库存");
+        });
     },
     /** 导出按钮操作 */
     handleExport() {

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

@@ -188,7 +188,7 @@
         </template>
       </el-table-column>
       <el-table-column label="出库人" align="center" prop="depositor" />
-      <el-table-column label="备注" align="center" prop="remark" />
+      <!-- <el-table-column label="备注" align="center" prop="remark" /> -->
       <el-table-column
         v-if="false"
         label="操作"

+ 2953 - 136
zkqy-ui/src/views/orderMange/retailMange/index.vue

@@ -1,176 +1,2993 @@
 <template>
-  <el-card>
-    <el-row :gutter="20">
-      <el-form
-        :model="queryForm"
-        ref="queryForm"
-        label-width="100px"
-        :inline="false"
-        size="samll"
+  <el-card shadow="always" :body-style="{ padding: '10px' }">
+    <div class="app-container">
+      <el-dialog
+        :title="upload.title"
+        :visible.sync="upload.open"
+        width="400px"
+        append-to-body
       >
-        <el-col :span="6">
-          <el-form-item label="超级查询">
-            <el-input
-              v-model="queryForm.queryParam"
-              placeholder="请输入"
-              @keyup.enter.native="getList"
-              clearable
-            ></el-input>
-          </el-form-item>
+        <el-upload
+          ref="upload"
+          :limit="1"
+          accept=".xlsx, .xls"
+          :headers="upload.headers"
+          :action="
+            upload.url +
+            '?updateSupport=' +
+            upload.updateSupport +
+            '&tableName=' +
+            tableName +
+            '&sqlKey=' +
+            tableKey
+          "
+          v-loading="upload.isUploading"
+          :disabled="upload.isUploading"
+          :on-progress="handleFileUploadProgress"
+          :on-success="handleFileSuccess"
+          :auto-upload="false"
+          :onChange="handleChange"
+          drag
+        >
+          <i class="el-icon-upload"></i>
+          <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
+          <div class="el-upload__tip text-center" slot="tip">
+            <!--          <div class="el-upload__tip" slot="tip">-->
+            <!--            <el-checkbox v-model="upload.updateSupport"/>-->
+            <!--            是否更新已经存在的用户数据-->
+            <!--          </div>-->
+            <span>仅允许导入xls、xlsx格式文件。</span>
+            <el-link
+              type="primary"
+              :underline="false"
+              style="font-size: 12px; vertical-align: baseline"
+              @click="importTemplate"
+              >下载模板
+            </el-link>
+          </div>
+        </el-upload>
+        <div slot="footer" class="dialog-footer">
+          <el-button type="primary" @click="submitFileForm">确 定</el-button>
+          <el-button @click="upload.open = false">取 消</el-button>
+        </div>
+      </el-dialog>
+      <Queryfrom
+        :form-vals="templateInfo.where"
+        :statisticList="statisticList"
+        :showCount="showCount"
+        :showSearch="showSearch"
+        @getList="getList"
+        ref="mychild"
+      />
+      <el-row :gutter="10" class="mb8">
+        <el-col :span="1.5">
+          <el-button
+            type="primary"
+            plain
+            icon="el-icon-plus"
+            size="mini"
+            @click="addHandler"
+            >新增
+          </el-button>
         </el-col>
-        <el-form-item>
-          <el-button size="mini" type="primary" @click="getList"
-            >搜索</el-button
-          >
-          <el-button icon="el-icon-refresh" size="mini" @click="resetQueryForm"
-            >重置</el-button
-          >
-        </el-form-item>
-      </el-form>
-    </el-row>
-    <div class="btnRow mb10">
-      <div class="btnList">
-        <el-button
-          type="primary"
-          plain
-          icon="el-icon-plus"
-          size="mini"
-          @click="addHandler"
-          >新增
-        </el-button>
-        <el-button
-          type="danger"
-          plain
-          icon="el-icon-delete"
-          size="mini"
-          :disabled="multiple"
-          @click="myDeleteHandler"
-          >删除
-        </el-button>
+        <!-- <el-col :span="1.5" v-if="false">
         <el-button
+          type="success"
           plain
-          icon="el-icon-upload2"
+          icon="el-icon-edit"
           size="mini"
-          @click="upload.open = true"
-          >导入
+          :disabled="single"
+          @click="handleUpdate"
+          >修改
         </el-button>
-        <el-button
-          type="warning"
-          plain
-          icon="el-icon-download"
-          size="mini"
-          @click="handleExport"
-          >导出
-        </el-button>
-      </div>
+      </el-col> -->
+        <el-col :span="1.5">
+          <el-button
+            type="danger"
+            plain
+            icon="el-icon-delete"
+            size="mini"
+            :disabled="multiple"
+            @click="myDeleteHandler"
+            >删除
+          </el-button>
+        </el-col>
+        <!-- <el-col :span="1.5">
+          <el-button
+            plain
+            icon="el-icon-upload2"
+            size="mini"
+            @click="upload.open = true"
+            >导入
+          </el-button>
+        </el-col>
+        <el-col :span="1.5">
+          <el-button
+            type="warning"
+            plain
+            icon="el-icon-download"
+            size="mini"
+            @click="handleExport"
+            >导出
+          </el-button>
+        </el-col>
+        <right-toolbar
+          style="float: right"
+          :showCount.sync="showCount"
+          :showSearch.sync="showSearch"
+          :counts="true"
+          @queryTable="pageList"
+        ></right-toolbar> -->
+      </el-row>
+      <el-table
+        v-loading="loading"
+        :data="tableList"
+        @selection-change="handleSelectionChange"
+        ref="tableRef"
+        :cell-style="cellStyle"
+        :reserve-selection="true"
+        row-key="saleOrderId"
+      >
+        <el-table-column
+          type="selection"
+          width="55"
+          reserve-selection
+          align="center"
+        >
+        </el-table-column>
+        <!-- <el-table-column type="selection" width="55" /> -->
+        <el-table-column prop="saleNo" label="合同号" />
+        <el-table-column prop="saleDate" label="日期" />
+        <el-table-column prop="customName" label="客户名称" />
+        <el-table-column prop="deliveryDate" label="交货日期" />
+        <el-table-column prop="saleLeadTime" label="交货天数" />
+        <el-table-column prop="saleAmountInWords" label="合计金额(大写)" />
+        <el-table-column prop="status" label="状态">
+          <template slot-scope="scope">
+            <el-tag :type="scope.row.listClass">{{
+              getDictLabel(scope.row.status, "sales_order_status")
+            }}</el-tag>
+          </template>
+        </el-table-column>
+
+        <el-table-column prop="salesman" label="销售员" />
+        <el-table-column prop="remark" label="备注" />
+        <el-table-column label="操作">
+          <template slot-scope="scope">
+            <el-dropdown>
+              <el-button type="warning" plain size="small">
+                操作<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-button
+                    size="mini"
+                    type="text"
+                    icon="el-icon-edit"
+                    @click="handleUpdate(scope.row)"
+                    >修改
+                  </el-button>
+                </el-dropdown-item>
+                <el-dropdown-item>
+                  <el-button
+                    size="mini"
+                    type="text"
+                    icon="el-icon-tickets"
+                    @click="handlePrint(scope.row)"
+                    >详情
+                  </el-button>
+                </el-dropdown-item>
+                <el-dropdown-item v-show="scope.row.status == 1">
+                  <el-button
+                    size="mini"
+                    type="text"
+                    icon="el-icon-folder-checked"
+                    @click="handleSubmit(scope.row)"
+                    >提交
+                  </el-button>
+                </el-dropdown-item>
+                <el-dropdown-item v-show="scope.row.status == 5">
+                  <el-button
+                    size="mini"
+                    type="text"
+                    icon="el-icon-folder-delete"
+                    @click="handleSubmitCancel(scope.row)"
+                    >撤销
+                  </el-button>
+                </el-dropdown-item>
+                <el-dropdown-item v-show="scope.row.status != 1">
+                  <el-button
+                    size="mini"
+                    type="text"
+                    icon="el-icon-folder-delete"
+                    @click="handleOutDetail(scope.row)"
+                    >出库明细
+                  </el-button>
+                </el-dropdown-item>
+                <el-dropdown-item
+                  v-show="
+                    scope.row.status == 1 ||
+                    scope.row.status == 2 ||
+                    scope.row.status == 8
+                  "
+                >
+                  <el-button
+                    size="mini"
+                    type="text"
+                    icon="el-icon-folder-delete"
+                    @click="myPrintOutBoundHandler(scope.row)"
+                    >打印出库单
+                  </el-button>
+                </el-dropdown-item>
+                <el-dropdown-item v-show="scope.row.status == 1">
+                  <el-button
+                    size="mini"
+                    type="text"
+                    icon="el-icon-delete"
+                    @click="handleDelete(scope.row)"
+                    >删除
+                  </el-button>
+                </el-dropdown-item>
+              </el-dropdown-menu>
+            </el-dropdown>
+          </template>
+        </el-table-column>
+      </el-table>
+      <pagination
+        v-show="total > 0"
+        :total="total"
+        :page.sync="queryParams.pageNum"
+        :limit.sync="queryParams.pageSize"
+        @pagination="pageList"
+      />
+
+      <!-- 添加或修改销售出库单:- 过磅记录生成数据对话框 -->
+      <el-dialog
+        :title="title"
+        width="1100px"
+        :visible.sync="open"
+        append-to-body
+      >
+        <el-row :gutter="20">
+          <el-form
+            :model="formData"
+            ref="formDataRef"
+            :rules="rules"
+            label-width="100px"
+            :inline="true"
+            size="normal"
+          >
+            <el-col :span="12">
+              <el-form-item prop="saleNo" label="合同号:">
+                <!-- <el-input size="small" v-model="formData.saleNo"></el-input> -->
+                {{ formData.saleNo }}
+              </el-form-item>
+            </el-col>
+            <!-- <el-col :span="12">
+              <el-form-item prop="lotNumber" label="批号:">
+                <el-input size="small" v-model="formData.lotNumber"></el-input>
+              </el-form-item>
+            </el-col> -->
+            <el-col :span="12">
+              <el-form-item prop="saleDate" label="日期:">
+                <!-- <el-date-picker
+                  size="small"
+                  v-model="formData.saleDate"
+                  value-format="yyyy-MM-dd"
+                  format="yyyy-MM-dd"
+                  type="date"
+                  placeholder="选择日期"
+                >
+                </el-date-picker> -->
+                {{ formData.saleDate }}
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item prop="saleCustomNo" label="客户名称:">
+                <el-select
+                  size="small"
+                  v-model="formData.saleCustomNo"
+                  placeholder="请选择客户"
+                  clearable
+                  filterable
+                  @change="customChangeHandler"
+                >
+                  <el-option
+                    v-for="item in customerOptions"
+                    :key="item.customNo"
+                    :label="item.customName"
+                    :value="item.customNo"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+
+            <el-col :span="12">
+              <el-form-item v-if="isLeader" label="业务员:">
+                <el-select
+                  size="small"
+                  v-model="formData.salesman"
+                  placeholder="请选择业务员"
+                  clearable
+                  filterable
+                  @change="salemanChange"
+                >
+                  <el-option
+                    v-for="item in salesmanList"
+                    :key="item.value"
+                    :label="item.label"
+                    :value="item.value"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+              <el-form-item v-else label="业务员:">
+                <!-- <el-input
+            v-model="formData.salesman"
+            size="small"
+            clearable
+          ></el-input> -->
+                {{ nickName }}
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="联系人:" size="normal">
+                {{ formData.contactPerson }}
+              </el-form-item>
+              <el-form-item label="客户地址:" size="normal">
+                {{ formData.customAddress }}
+              </el-form-item>
+              <el-form-item label="客户国别:" size="normal">
+                {{ formData.customCountryType }}
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label-width="120px" label="合计金额(大写):">
+                <!-- <el-input
+                  v-model="formData.saleAmountInWords"
+                  size="small"
+                  clearable
+                ></el-input> -->
+                {{ formData.saleAmountInWords }}
+              </el-form-item>
+            </el-col>
+            <!-- <el-col :span="12">
+              <el-form-item label="付款方式:">
+                <el-select
+                  v-model="formData.salePayType"
+                  size="small"
+                  clearable
+                  filterable
+                >
+                  <el-option
+                    v-for="item in dict.type.retail_order_pay_method"
+                    :key="item.value"
+                    :label="item.label"
+                    :value="item.value"
+                  ></el-option>
+                </el-select>
+                零售单
+              </el-form-item>
+            </el-col> -->
+
+            <!-- <el-col :span="12">
+              <el-form-item
+                label-width="120px"
+                prop="saleOrderEstimatedTime"
+                label="预计下单时间:"
+              >
+                {{ formData.saleOrderEstimatedTime }}
+              </el-form-item>
+            </el-col> -->
+
+            <!-- <el-col :span="12">
+              <el-form-item label="交货日期:" size="normal" prop="deliveryDate">
+                {{ formData.deliveryDate }}
+              </el-form-item>
+            </el-col> -->
+            <!-- <el-col :span="12">
+              <el-form-item label="交货天数:" size="normal" prop="saleLeadTime">
+                {{ formData.saleLeadTime }}
+              </el-form-item>
+            </el-col> -->
+            <el-col :span="24">
+              <el-divider>货品明细</el-divider>
+            </el-col>
+            <el-table
+              :data="productionTableData"
+              border
+              show-summary
+              :summary-method="getSummaries"
+              sum-text="小计"
+              style="width: 100%"
+            >
+              <el-table-column prop="productName" label="品名" width="180">
+                <template slot-scope="scope">
+                  <!-- <el-input
+                v-model="scope.row.productName"
+                size="small"
+                clearable
+              ></el-input> -->
+                  <el-select
+                    v-model="scope.row.productNo"
+                    placeholder=""
+                    :filter-method="(val) => mySelectFilter(val, scope.row)"
+                    clearable
+                    filterable
+                    @change="
+                      handleProductChange(scope.row.productNo, scope.row)
+                    "
+                  >
+                    <el-option
+                      v-for="item in productionOptions"
+                      :key="item.productNo"
+                      :label="item.productName"
+                      :value="item.productNo"
+                    >
+                      <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>
+                </template>
+              </el-table-column>
+              <el-table-column prop="productType" label="类型">
+              </el-table-column>
+              <el-table-column prop="productNumber" label="箱数">
+                <template slot-scope="scope">
+                  <el-input
+                    v-model="scope.row.productNumber"
+                    oninput="value=value.replace(/[^0-9.]/g,'')"
+                    size="small"
+                    clearable
+                    @change="computedPrice(scope.row)"
+                  ></el-input>
+                </template>
+              </el-table-column>
+              <el-table-column prop="productUnitPrice" label="单价">
+                <template slot-scope="scope">
+                  <el-input
+                    v-model="scope.row.productUnitPrice"
+                    size="small"
+                    oninput="value=value.replace(/[^0-9.]/g,'')"
+                    @change="computedPrice(scope.row)"
+                    clearable
+                  ></el-input>
+                </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="sliceType" label="切片型号">
+                <template slot-scope="scope">
+                  <el-select
+                    v-model="scope.row.sliceType"
+                    placeholder=""
+                    clearable
+                    filterable
+                    @change="sliceTypeChangeHandler(scope.row)"
+                  >
+                    <el-option
+                      v-for="item in sliceTypeOptions"
+                      :key="item.materielCode"
+                      :label="item.materielName"
+                      :value="item.materielCode"
+                    >
+                    </el-option>
+                  </el-select>
+                </template>
+              </el-table-column>
+              <el-table-column prop="colourNumber" label="色号">
+                <template slot-scope="scope">
+                  <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>
+                </template>
+              </el-table-column>
+              <el-table-column prop="remark" label="备注">
+                <template slot-scope="scope">
+                  <el-input
+                    v-model="scope.row.remark"
+                    size="small"
+                    clearable
+                  ></el-input>
+                </template>
+              </el-table-column>
+              <el-table-column label="操作">
+                <template slot-scope="scope">
+                  <el-button
+                    type="danger"
+                    size="small"
+                    @click="deleteProduct(scope.$index)"
+                    >删除</el-button
+                  >
+                </template>
+              </el-table-column>
+            </el-table>
+            <el-button
+              class="mt5"
+              type="primary"
+              style="width: 100%"
+              size="small"
+              @click="addProduct"
+              >添加货品</el-button
+            >
+
+            <!-- <el-col :span="12" v-show="formData.salePayType == '1'">
+              <el-form-item prop="earnestMoney" label="定金">
+                <el-input
+                  v-model="formData.earnestMoney"
+                  clearable
+                  size="small"
+                />
+              </el-form-item>
+            </el-col> -->
+            <el-col :span="24">
+              <el-divider>订单备注</el-divider>
+            </el-col>
+            <el-col :span="24">
+              <el-input
+                type="textarea"
+                v-model="formData.orderRemark"
+                placeholder=""
+                size="normal"
+                clearable
+              ></el-input>
+            </el-col>
+            <!-- <el-col :span="24">
+              <el-divider>审计人员数据</el-divider>
+            </el-col> -->
+          </el-form>
+        </el-row>
+        <div slot="footer" class="dialog-footer">
+          <el-button type="primary" @click="editConfirm">确 定</el-button>
+          <el-button @click="cancel">取 消</el-button>
+        </div>
+      </el-dialog>
+
+      <!-- 自定义弹窗 -->
+      <el-dialog title="提交" :visible.sync="deliverShow" width="1200px">
+        <!-- <DialogTemplate
+        ref="dialogRef"
+        :groupKey="groupKey"
+        :rowobj="rowobj"
+        :subCount="subCount"
+        :tableCount="tableCount"
+        :subTableName="subTableName"
+        @addList="addListHandler"
+      >
+      </DialogTemplate> -->
+        <RetailProvide ref="deliverRef"></RetailProvide>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="deliverShow = false">取 消</el-button>
+          <!-- <el-button @click="btnSave">保 存</el-button> -->
+          <el-button type="primary" @click="btnComfirm">确 定</el-button>
+        </span>
+      </el-dialog>
+      <!-- 详情弹窗 -->
+      <el-dialog title="详情" :visible.sync="detailShow" width="1250px">
+        <div ref="detailTable" id="detail"></div>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="detailShow = false">取 消</el-button>
+          <el-button type="primary" @click="detailPrintHandler"
+            >打 印</el-button
+          >
+        </span>
+      </el-dialog>
+      <!-- 销售出库弹窗 -->
+      <el-dialog
+        title="打印-销售出库单"
+        :visible.sync="outBoundShow"
+        width="1000px"
+      >
+        <OutBound ref="outBoundRef" :currentRow="currentRow"></OutBound>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="outBoundShow = false">取 消</el-button>
+          <el-button type="primary" @click="outBoundPrintHandler">
+            打印</el-button
+          >
+        </span>
+      </el-dialog>
+      <!-- 出库详情 -->
+      <el-dialog title="出库明细" :visible.sync="outStockShow" width="1200px">
+        <OutStock ref="outStockRef"></OutStock>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="outStockShow = false">关 闭</el-button>
+          <!-- <el-button @click="btnSave">保 存</el-button> -->
+          <!-- <el-button type="primary" @click="btnComfirm">确 定</el-button> -->
+        </span>
+      </el-dialog>
+      <div id="printDom"></div>
     </div>
-    <!-- 列表 -->
-    <el-table
-      :data="tableList"
-      border
-      stripe
-      @selection-change="handleSelectionChange"
-    >
-      <el-table-column type="selection" width="55" />
-      <el-table-column prop="saleDate" label="日期" />
-      <el-table-column prop="customName" label="客户名称" />
-      <el-table-column prop="deliveryDate" label="交货日期" />
-      <el-table-column prop="saleLeadTime" label="交货天数" />
-      <el-table-column prop="saleAmountInWords" label="合计金额" />
-      <el-table-column prop="salesman" label="销售员" />
-      <el-table-column prop="remark" label="备注" />
-      <el-table-column label="操作">
-        <template slot-scope="scope">
-          <el-dropdown>
-            <el-button type="warning" plain size="small">
-              操作<i class="el-icon-arrow-down el-icon--right"></i>
-            </el-button>
-            <el-dropdown-menu slot="dropdown">
-              <el-dropdown-item>
-                <el-button
-                  size="mini"
-                  type="text"
-                  icon="el-icon-edit"
-                  @click="handleUpdate(scope.row)"
-                  v-hasPermi="['system:productCodeList:edit']"
-                  >修改
-                </el-button>
-              </el-dropdown-item>
-              <el-dropdown-item>
-                <el-button
-                  size="mini"
-                  type="text"
-                  icon="el-icon-delete"
-                  @click="handleDelete(scope.row)"
-                  v-hasPermi="['system:productCodeList:remove']"
-                  >删除
-                </el-button>
-              </el-dropdown-item>
-            </el-dropdown-menu>
-          </el-dropdown>
-        </template>
-      </el-table-column>
-    </el-table>
-    <pagination
-      v-show="total > 0"
-      :total="total"
-      :page.sync="queryForm.pageNum"
-      :limit.sync="queryForm.pageSize"
-      @pagination="getList"
-    />
   </el-card>
-  <!-- 添加或修改订单信息对话框 -->
 </template>
-
 <script>
-import { saleOrderList } from "@/api/system/retailMange.js";
+import {
+  delTableData,
+  dragTableInfo,
+  listTable,
+  unionListTableData,
+  getInfoBySqlKey,
+  btnCommonApi,
+  addTableData,
+  batchEdit,
+  getStatisticList,
+  getTableList1,
+  checkOrderNo,
+  delOrder,
+  productInvoiceInfo,
+  addProductInvoice,
+  updateProductInvoice,
+  queryMaterielList,
+} from "@/api/tablelist/commonTable";
+import {
+  saleOrderList,
+  getRoleUser,
+  addRetailOrder,
+  getRetailOrderInfo,
+  editRetailOrder,
+  retailProductInvoiceInfo,
+  submitRetailOrder,
+  cancelRetailOrder,
+} 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";
+import { camelCase, toUnderline } from "@/utils";
+import { inputDisableComplete } from "@/utils/other";
+import Menu from "@/views/tablelist/commonTable/BtnMenu.vue";
+import { checkRole } from "@/utils/permission";
+import DialogTemplate from "@/views/dialogTemplate/components/index.vue";
+import {
+  queryDropDownBoxData,
+  getSaleOrderProductionList,
+} from "@/api/dragform/form";
+import { v4 as uuidv4 } from "uuid";
+import { mapState } from "vuex";
+import moment from "moment";
+import Deliver from "@/views/orderMange/components/dialogForm/Deliver.vue";
+import RetailProvide from "@/views/orderMange/components/dialogForm/RetailProvide.vue";
+import OutStock from "@/views/orderMange/components/dialogForm/OutStock.vue";
+import OutBound from "@/views/orderMange/components/dialogForm/OutBound.vue";
+import outBoundPrint from "@/utils/print/outBoundPrint";
+import { listCustomer } from "@/api/system/customer";
+import { numToCapital } from "@/utils/other";
 export default {
   name: "retailMange",
-  props: [],
-  components: {},
+  dicts: [
+    "payment_method",
+    "direction_of_twist",
+    "retail_order_pay_method",
+    "sales_order_status",
+  ],
+  components: {
+    Queryfrom,
+    Menu,
+    DialogTemplate,
+    Deliver,
+    OutBound,
+    RetailProvide,
+    OutStock,
+  },
   data() {
     return {
-      // 查询参数
-      queryForm: {
-        pageNum: 1, // 第几页
-        pageSize: 10, // 每页大小
-        queryParam: "",
-      },
-      // 表格数据
-      tableList: [],
+      outStockShow: false, //出库详情弹窗
+      totalMoney: "", //合计金额  小写
+      createById: "", //创建者id
+      salesmanList: [], //销售员列表
+      isLeader: false, //当前登录用户是否为领导
+      selection: [], //勾选的数据
+      // 出库单 start
+      outBoundShow: false,
+      // 出库单 end
+      // 发货 start
+      deliverShow: false,
+      // 发货 end
 
-      // 新增或修改弹窗参数
-      // start
+      // 出库单  start
+
+      // 出库单  end
+      myDelIds: [], //新增接口 删除的id
+      // 详情弹窗数据
+      detailShow: false,
+      printDomData: "",
+      // k-form-build组件渲染弹窗
+      kOpen: false,
+      // 新的自定义数据 start
+      orderType: 0, //新的条件查询参数
+      productIds: [], //货品Ids
+      isEdit: false,
+      formData: {
+        //订单表数据
+        saleNo: "", //合同号
+        saleCustomNo: "", //客户编号
+        saleDate: "", //销售单日期
+        saleOrderEstimatedTime: "", //预计下单时间
+        saleLeadTime: "1", //交货周期
+        deliveryDate: "", //交货日期
+        saleAmounts: "", //合计金额 小写
+        saleAmountInWords: "", //合计金额 大写
+        salePayType: "1", //支付方式
+        earnestMoney: "", //定金
+        salesman: "", //业务员
+        saleLeader: "", //业务主管
+        finance: "", //财务部
+        production: "", //生产部
+        saleApprover: "", //批准人
+        customAddress: "", //客户地址
+        customCountryType: "", //国家类型
+        contactPerson: "", //联系人
+        // 货品明细表数据
+        lotNumber: "", //批号
+        productNo: "", //货品号
+        productName: "", //货品名称
+        productNumber: "", //销售数量
+        productWeight: "", //销售重量kg
+        productUnitPrice: "", //单价
+        productAmounts: "", //金额
+        sliceType: "", //切片类型
+        sliceTypeLabel: "",
+        colourNumberLabel: "",
+        colourNumber: "", //色号
+        remark: "", //备注
+        // 工艺表
+        orderRemark: "",
+      },
+      sliceTypeOptions: [], //切片型号选项
+      colourNumberOptions: [], //色号选项
+      allProductionOptions: [], //所有产品选项
+      productionOptions: [],
+      customerOptions: [],
+      productionTableData: [
+        // {
+        //   productNo: "", //货品名称
+        //   productNumber: 2, //销售数量
+        //   productWeight: 1, //销售重量kg
+        //   productUnitPrice: 20, //单价
+        //   productAmounts: 20, //金额
+        //   remark: "", //备注
+        // },
+      ],
+      rules: {
+        saleNo: [
+          {
+            required: true,
+            message: "请输入合同号",
+            trigger: "blur",
+          },
+          // {
+          //   validator: this.validateOrderNo,
+          //   trigger: "blur",
+          // },
+        ],
+        saleDate: [
+          {
+            required: true,
+            message: "请选择日期",
+            trigger: "change",
+          },
+        ],
+        // lotNumber: [
+        //   {
+        //     required: true,
+        //     message: "请输入批号",
+        //     trigger: "blur",
+        //   },
+        // ],
+        saleCustomNo: [
+          {
+            required: true,
+            message: "请选择客户",
+            trigger: "change",
+          },
+        ],
+        saleOrderEstimatedTime: [
+          {
+            required: true,
+            message: "请选择预计下单时间",
+            trigger: "change",
+          },
+        ],
+        saleLeadTime: [
+          {
+            required: true,
+            message: "请输入交货天数",
+            trigger: "blur",
+          },
+        ],
+        // earnestMoney: [
+        //   {
+        //     validator: this.validateEarnestMoney,
+        //     trigger: "blur",
+        //   },
+        // ],
+      },
 
       // end
+      // 绑定按钮dialog
+      btnDialogVisible: false,
+      // 绑定修改dialog
+      groupKey: "",
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示统计
+      showCount: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 用户表格数据
+      tableList: [],
+      // 弹出层标题
+      title: "",
+      // 日期范围
+      dateRange: [],
+      // 表单参数
+      form: {},
+      // cru 弹窗
+      open: false,
+      // excel共通导入数据
+      upload: {
+        // 是否显示弹出层
+        open: false,
+        // 弹出层标题(
+        title: "",
+        // 是否禁用上传
+        isUploading: false,
+        // 是否更新已经存在的数据
+        updateSupport: 0,
+        // 设置上传的请求头部
+        headers: { Authorization: "Bearer " + getToken() },
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API1 + "common/uploadData",
+      },
+      // 排序方式 默认降序
+      sortOrder: true,
+      // 共通查询参数接受子组件的参数
+      queryParams: {
+        saleOrderTechnologyNo: "retailOrder",
+        pageNum: 1, // 第几页
+        pageSize: 10, // 每页大小
+        orderByColumn: "", // 根据某列排序
+        isAsc: "", // desc(降序)或 asc(升序)
+        saleOrderOrderType: "",
+        // 基本查询参数
+        basicMap: {
+          tableName: "drag_form",
+        },
+        // 当前表字段筛选参数
+        queryMap: {
+          queryCriteriaValue: "",
+        },
+      },
+      // 列信息
+      columns: {},
+      // 当前模版信息
+      templateInfo: {},
+      // 查询条件
+      queryFromWhere: {},
+      // 当前table唯一标识
+      tableKey: null,
+      // 当前表名称
+      tableName: null,
+      //存放html代码块
+      iframeUrl: "",
+      //存放表单渲染数据
+      jsonData: {},
+      // 回显表格数据,
+      defaultValue: {},
+      // 统计card
+      statisticList: [],
+      // 样式表
+      styleList: [],
+      // 字典样式对象
+      dictStyleObj: {},
+      // 操作列 按钮数据
+      excuteBtnArr: [],
+      // 下拉框动态数据
+      dynamicData: {},
+      // 当前点击按钮的数据
+      currentBtnData: {},
+      // 修改选中行
+      rowobj: {},
+      // 该行的统计信息
+      subCount: [],
+      tableCount: [],
+      // 弹窗新增数据
+      addLists: [],
+      subTableName: "",
+      // 当前点击行的数据
+      currentRow: {},
     };
   },
-  computed: {},
-  mounted() {
-    this.getList();
+
+  created() {
+    // 得到当前展示的table的唯一标识
+    this.tableKey = this.$route.query.tableKey;
+  },
+  watch: {
+    totalMoney: {
+      handler(newVal, oldVal) {
+        if (isNaN(Number(newVal))) {
+          this.formData.saleAmountInWords = "零";
+        } else {
+          const ntc = new numToCapital();
+          this.formData.saleAmountInWords = ntc.uppercase(newVal);
+        }
+      },
+      deep: true,
+      immediate: true,
+    },
+  },
+  async mounted() {
+    await this.getDropDownData();
+  },
+  computed: {
+    isShowExcuteCol() {
+      return !this.excuteBtnArr?.every((arr) => arr.children.length == 0);
+    },
+    ...mapState({
+      nickName: (state) => state.user.nickName,
+      userInfo: (state) => state.user,
+    }),
   },
   methods: {
-    // 表格数据查询
+    // 出库单回调
+    async myPrintOutBoundHandler(row) {
+      console.log("row", row);
+      this.currentRow = row;
+      this.outBoundShow = true;
+      this.$nextTick(() => {
+        this.$refs.outBoundRef.getTableData(row);
+      });
+    },
+    // 出库详情回调
+    handleOutDetail(row) {
+      this.outStockShow = true;
+      this.$nextTick(() => {
+        this.$refs.outStockRef.getOutStockDetail(row);
+      });
+    },
+    // 业务员改变回调
+    salemanChange(val) {
+      if (!val) {
+        this.createById = "";
+        return;
+      } else {
+        this.createById = this.salesmanList.find(
+          (item) => item.value == val
+        ).id;
+      }
+    },
+    // 生成合同号
+    getSaleNo() {
+      let timeStr = moment().format("YYYYMMDD");
+      for (var i = 0; i < 5; i++) {
+        timeStr += parseInt(Math.random() * 10);
+      }
+      return timeStr;
+    },
+    // 自定义筛选方法
+    mySelectFilter(value, row) {
+      console.log(value);
+      // row.productNo = value;
+      if (value) {
+        let target = this.productionOptions.find((item) =>
+          item.productName.includes(value)
+        );
+        console.log(target);
+        if (target) {
+          this.productionOptions = [target];
+          //找到
+          return true;
+        } else {
+          //前100个没找到
+          // 在全部列表中查找
+          target = this.allProductionOptions.find((item) =>
+            item.productName.includes(value)
+          );
+          console.log(target);
+          if (target) {
+            this.productionOptions = [target];
+            return true;
+          } else {
+            return false;
+          }
+        }
+      } else {
+        this.productionOptions = this.allProductionOptions.slice(0, 500);
+      }
+    },
+    // 出库单回调
+    async myPrintOutBoundHandler(row, data) {
+      console.log("row", row);
+      this.currentRow = row;
+      this.outBoundShow = true;
+      this.$nextTick(() => {
+        this.$refs.outBoundRef.getTableData(row);
+      });
+    },
+    // 出库单打印回调
+    async outBoundPrintHandler() {
+      let res = await this.$refs.outBoundRef.getPrintData();
+      console.log(res);
+      if (res.flag) {
+        res.data.form.printUser = this.nickName;
+        outBoundPrint(res.data, "printDom", true);
+      }
+    },
+
+    // 产品名称改变
+    handleProductChange(productNo, row) {
+      if (!productNo) {
+        this.productionOptions = this.allProductionOptions.slice(0, 500);
+        return;
+      }
+      row.productName = this.productionOptions.find(
+        (item) => item.productNo == productNo
+      )?.productName;
+      row.productType = this.productionOptions.find(
+        (item) => item.productNo == productNo
+      )?.productType;
+      this.productionOptions = this.allProductionOptions.slice(0, 500);
+    },
+    // 订单类型改变回调
+    orderTypeChange(type) {
+      this.getList(false, type);
+    },
+    // 重置审计表单数据
+    resetFormData() {
+      Object.assign(this.formData, {
+        //订单表数据
+        saleNo: this.getSaleNo(), //合同号
+        saleCustomNo: "", //客户编号
+        saleDate: moment(new Date()).format("YYYY-MM-DD"), //销售单日期
+        saleOrderEstimatedTime: moment(new Date()).format("YYYY-MM-DD"), //预计下单时间
+        saleLeadTime: "1", //交货周期
+        deliveryDate: moment(new Date()).format("YYYY-MM-DD"),
+        saleAmounts: "", //合计金额 小写
+        saleAmountInWords: "", //合计金额 大写
+        salePayType: "1", //支付方式
+        earnestMoney: "",
+        salesman: "", //业务员
+        saleLeader: "", //业务主管
+        finance: "", //财务部
+        production: "", //生产部
+        saleApprover: "", //批准人
+        customAddress: "", //客户地址
+        customCountryType: "", //国家类型
+        contactPerson: "", //联系人
+        // 货品明细表数据
+        lotNumber: "", //批号
+        productNo: "", //货品号
+        productName: "", //货品名称
+        productNumber: "", //销售数量
+        productWeight: "", //销售重量kg
+        productUnitPrice: "", //单价
+        productAmounts: "", //金额
+        sliceType: "", //切片类型
+        sliceTypeLabel: "",
+        colourNumberLabel: "",
+        colourNumber: "", //色号
+        remark: "", //备注
+        // 工艺表
+        craftGrid: "", //网络
+        craftOil: "", //油剂
+        craftPackage: "", //卷装
+        craftColorFastness: "", //色牢度
+        directionOfTwist: "",
+        craftOther: "", //其它工艺要求
+        craftMark: "", //包装/贴唛
+        shippingMethod: "", //运输方式
+      });
+      this.productionTableData = [];
+    },
+    // 自定义的小计计算方法
+    getSummaries(param) {
+      const { columns, data } = param;
+      console.log(columns, data);
+      const sums = [];
+      columns.forEach((column, index) => {
+        if (index === 0) {
+          sums[index] = "小计";
+          return;
+        }
+        const values = data.map((item) => Number(item[column.property]));
+        if (
+          index === 1 ||
+          index === 5 ||
+          index === 6 ||
+          index === 7 ||
+          index === 8
+        ) {
+          sums[index] = "";
+        } else if (!values.every((value) => isNaN(value))) {
+          sums[index] = values
+            .reduce((prev, curr) => {
+              const value = Number(curr);
+              if (!isNaN(value)) {
+                return prev + curr;
+              } else {
+                return prev;
+              }
+            }, 0)
+            ?.toFixed(2);
+          console.log(sums[index], index);
+          if (index == 4) {
+            this.totalMoney = sums[index];
+          }
+        } else {
+          sums[index] = "N/A";
+        }
+      });
+
+      return sums;
+    },
+    // 货品表格数据删除回调
+    deleteProduct(index) {
+      this.productionTableData.splice(index, 1);
+    },
+    // 货品表格数据新增回调
+    addProduct() {
+      this.productionTableData.push({
+        saleProductNo: uuidv4(),
+        productNo: "", //货品编号
+        productType: "", //类型
+        productName: "", //货品名称
+        productNumber: "", //销售数量
+        productWeight: "", //销售重量kg
+        productUnitPrice: "", //单价
+        productAmounts: "", //金额
+        sliceType: "022", //切片类型  初始为  切片
+        sliceTypeLabel: "",
+        colourNumberLabel: "",
+        colourNumber: "", //色号
+        remark: "", //备注
+      });
+    },
+    // 客户名称改变回调
+    customChangeHandler(val) {
+      // if (!val) return;
+      let customData = this.customerOptions.find(
+        (item) => item.customNo == val
+      );
+      this.formData.customAddress = customData?.customAddress || "无";
+      this.formData.customCountryType = customData?.customCountryType || "无";
+      this.formData.contactPerson = customData?.contactPerson || "无";
+    },
+    // 获取销售员角色列表
+    async getRoleUser() {
+      try {
+        let res = await getRoleUser("salesman");
+        if (res.code == 200) {
+          this.salesmanList = res.data.map((item) => {
+            return {
+              label: item.nickName,
+              value: item.nickName,
+              id: item.userId,
+            };
+          });
+        } else {
+          this.$message.error("获取销售员角色列表失败");
+        }
+      } catch (error) {
+        console.log(error);
+      }
+    },
+    //审计新增
+    async addHandler() {
+      this.isEdit = false;
+
+      await this.getDropDownData();
+      // 判断是否是销售员
+      console.log(this.userInfo);
+      this.isLeader = !this.userInfo.roles.includes("salesman");
+      if (!this.isLeader) {
+        this.createById = this.userInfo.userId;
+      }
+      await this.getRoleUser();
+      this.resetFormData();
+
+      this.title = "新增零售单";
+      this.open = true;
+      this.$nextTick(() => {
+        this.$refs.formDataRef.resetFields();
+        this.formData.orderRemark = "";
+        // this.$refs["formDataRef"].clearValidate();
+      });
+    },
+    // 获取下拉框数据
+    async getDropDownData() {
+      try {
+        // let payLoad = [
+        //   {
+        //     basicMap: {
+        //       tableName: "production",
+        //     },
+        //   },
+        //   {
+        //     basicMap: {
+        //       tableName: "customer",
+        //     },
+        //   },
+        // ];
+        // let res = await queryDropDownBoxData(payLoad);
+
+        // 新的获取客户选项数据的接口
+        let res = await listCustomer({ isEnablePaging: false });
+        if (res.code == 200) {
+          // let { customer } = res.data.resultMap;
+          // this.allProductionOptions = production || [];
+          // this.productionOptions =
+          //   this.allProductionOptions.slice(0, 100) || [];
+          this.customerOptions = res.rows || [];
+        } else {
+          throw Error("获取下拉框数据失败");
+        }
+        let proRes = await getSaleOrderProductionList();
+        if (proRes.code == 200) {
+          // let { production, customer } = proRes.data.resultMap;
+          this.allProductionOptions = proRes.data || [];
+          this.productionOptions =
+            this.allProductionOptions.slice(0, 500) || [];
+        } else {
+          throw Error("获取下拉框数据失败");
+        }
+      } catch (error) {
+        console.log(error);
+      }
+      // 色号数据
+      try {
+        let payLoad = [
+          {
+            basicMap: {
+              tableName: "materiel",
+            },
+            conditionMap: {
+              materiel_species: ["1"],
+            },
+          },
+        ];
+        // let res = await queryDropDownBoxData(payLoad);
+        let res = await queryMaterielList();
+        if (res.code == 200) {
+          // let { materiel } = res.data;
+          this.colourNumberOptions = res.data || [];
+        } else {
+          throw Error("获取下拉框数据失败");
+        }
+      } catch (error) {
+        console.log(error);
+      }
+      // 切片型号
+      try {
+        let payLoad = [
+          {
+            basicMap: {
+              tableName: "materiel",
+            },
+            conditionMap: {
+              materiel_species: ["6"],
+            },
+          },
+        ];
+        let res = await queryDropDownBoxData(payLoad);
+        if (res.code == 200) {
+          console.log(res.data.resultMap);
+          let { materiel } = res.data.resultMap;
+          this.sliceTypeOptions = materiel || [];
+        } else {
+          throw Error("获取下拉框数据失败");
+        }
+      } catch (error) {
+        console.log(error);
+      }
+    },
+    //
+    // 获取row-key
+    getRowKey(row) {
+      return row[
+        camelCase(this.tableName + "_" + this.templateInfo.template?.primaryKey)
+      ];
+    },
+    /** 查询列表 */
     async getList() {
+      this.loading = true;
       try {
-        let res = await saleOrderList(this.queryForm);
+        let res = await saleOrderList(this.queryParams);
         console.log(res);
         if (res.code == 200) {
           this.tableList = res.rows;
+          console.log(this.dict.type.sales_order_status);
+          this.tableList.forEach((item) => {
+            item.listClass = this.dict.type.sales_order_status.find(
+              (i) => i.value == item.status
+            ).raw.listClass;
+          });
           this.total = res.total;
         } else {
           this.$message.error(res.msg);
         }
+        this.loading = false;
+      } catch (error) {
+        console.log(error);
+        this.loading = false;
+      }
+    },
+    // 校验定金
+    validateEarnestMoney(rule, value, callback) {
+      console.log(value);
+      if (this.formData.salePayType == "1") {
+        if (value == "" || value == null || value == undefined) {
+          callback(new Error("请输入定金金额"));
+        } else {
+          callback();
+        }
+      } else {
+        callback();
+      }
+    },
+    // 校验订单号是否有效
+    async validateOrderNo(rule, value, callback) {
+      console.log(value);
+      // let saleNo = this.formData.orderNo;
+      // 检验订单号合法
+      let checkNoPayload = {
+        saleNo: value,
+      };
+      if (this.isEdit) {
+        checkNoPayload.id = this.formData.id;
+      }
+      let result = await checkOrderNo(checkNoPayload);
+      if (result.code == 200) {
+        if (result.data) {
+          callback();
+        } else {
+          callback(new Error("合同号已存在"));
+        }
+      } else {
+        callback(new Error("校验失败,请稍后再试"));
+      }
+    },
+    // 校验表格数据
+    validateTableData() {
+      if (this.productionTableData.length == 0) {
+        return {
+          res: false,
+          msg: "请添加货品明细",
+        };
+      }
+      let res = this.productionTableData.every((item) => {
+        return (
+          item.productNo &&
+          item.productNumber &&
+          item.productUnitPrice &&
+          item.productAmounts &&
+          item.sliceType &&
+          item.colourNumber
+        );
+      });
+      if (!res) {
+        return {
+          res: false,
+          msg: "请填写完整货品明细",
+        };
+      }
+      return {
+        res: true,
+        msg: "",
+      };
+    },
+    // 审计   提交编辑结果按钮回调
+    async editConfirm() {
+      this.$refs.formDataRef.validate(async (valid) => {
+        if (valid) {
+          console.log(valid);
+          let tableValidate = this.validateTableData();
+          if (!tableValidate.res) {
+            this.$message.warning(tableValidate.msg);
+            return;
+          }
+          let {
+            id,
+            //订单表数据
+            saleNo,
+            saleCustomNo,
+            saleDate,
+            saleOrderEstimatedTime,
+            saleLeadTime,
+            deliveryDate,
+            saleAmounts,
+            saleAmountInWords,
+            salePayType,
+            salesman,
+            customAddress,
+            customCountryType, //国家类型
+            contactPerson, //联系人
+
+            // 工艺表数据
+            orderRemark,
+          } = this.formData;
+          let payload = {
+            createById: this.createById,
+            saleOrderTechnologyNo: "retailOrder",
+            saleNo,
+            saleCustomNo,
+            saleDate,
+            saleOrderEstimatedTime,
+            saleLeadTime,
+            deliveryDate,
+            saleAmounts,
+            saleAmountInWords,
+            salePayType,
+            customAddress, //客户地址
+            customCountryType, //国家类型
+            contactPerson, //联系人
+            remark: orderRemark,
+            salesman: this.isLeader ? salesman : this.nickName,
+            status: 1,
+          };
+          payload.saleProductsList = this.productionTableData;
+
+          if (this.isEdit) {
+            payload.id = id;
+            let res = await editRetailOrder(payload);
+            if (res.code === 200) {
+              this.$message.success("修改成功");
+              this.open = false;
+              this.getList();
+            } else {
+              this.$message.error("修改失败");
+            }
+          } else {
+            //新增
+            let res = await addRetailOrder(payload);
+            if (res.code == 200) {
+              this.$message.success("添加成功");
+              this.open = false;
+              this.getList();
+            } else {
+              this.$message.error("添加失败");
+            }
+          }
+          // Object.keys(saleValue).map((k) => {
+          //   saleData.commMap[k] = saleValue[k];
+          // });
+        }
+      });
+    },
+    // 审计   编辑回调
+    async handleEdit(index, row) {
+      console.log(row);
+      let { saleOrderSaleNo } = row;
+      try {
+        let payLoad = [
+          {
+            basicMap: {
+              tableName: "sale_order",
+            },
+            conditionMap: {
+              sale_no: [saleOrderSaleNo],
+            },
+          },
+          {
+            basicMap: {
+              tableName: "sale_products",
+            },
+            conditionMap: {
+              sale_order_no: [saleOrderSaleNo],
+            },
+          },
+          {
+            basicMap: {
+              tableName: "sale_craft",
+            },
+            conditionMap: {
+              sale_order_no: [saleOrderSaleNo],
+            },
+          },
+        ];
+        let res = await queryDropDownBoxData(payLoad);
+        if (res.code == 200) {
+          this.isEdit = true;
+          let { sale_craft, sale_order, sale_products } = res.data.resultMap;
+
+          Object.assign(this.formData, {
+            ...sale_craft[0],
+            ...sale_order[0],
+          });
+          let { saleDate, saleOrderEstimatedTime, deliveryDate } =
+            sale_order[0];
+          saleDate && (this.formData.saleDate = new Date(saleDate));
+          saleOrderEstimatedTime &&
+            (this.formData.saleOrderEstimatedTime = saleOrderEstimatedTime);
+          deliveryDate && (this.formData.deliveryDate = new Date(deliveryDate));
+
+          this.productIds = sale_products.map((item) => item.saleProductNo);
+
+          await this.getDropDownData();
+          this.productionTableData = sale_products.map((item) => {
+            item.productType = this.productionOptions.find(
+              (i) => item.productNo == i.productNo
+            )?.productType;
+            return item;
+          });
+          if (this.formData.saleCustomNo) {
+            this.customChangeHandler(this.formData.saleCustomNo);
+          }
+          this.title = "编辑审计单";
+          this.open = true;
+        }
       } catch (error) {
         console.log(error);
       }
     },
-    resetQueryForm() {
-      this.queryForm.queryParam = "";
-      this.getList();
+    // 审计   批量删除回调
+    async batchDelete() {
+      if (!this.ids.length) return;
+      try {
+        await this.$confirm("是否确认删除选中的数据?", "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        });
+        let orderPayload = {
+          basicMap: {
+            tableName: "sale_order",
+          },
+          conditionMap: {
+            saleNo: this.ids,
+          },
+        };
+        let productsPayload = {
+          basicMap: {
+            tableName: "sale_products",
+          },
+          conditionMap: {
+            saleOrderNo: this.ids,
+          },
+        };
+        let craftPayload = {
+          basicMap: {
+            tableName: "sale_craft",
+          },
+          conditionMap: {
+            saleOrderNo: this.ids,
+          },
+        };
+        let orderRes = await delTableData(orderPayload);
+        // let productRes = await delTableData(productsPayload);
+        // let craftRes = await delTableData(craftPayload);
+        if (orderRes.code == 200) {
+          this.$message.success("删除成功");
+          this.getList();
+        } else {
+          this.$message.error("删除失败");
+          throw Error("删除失败");
+        }
+        this.ids = [];
+        this.$refs.tableRef.clearSelection();
+      } catch (error) {
+        console.log(error);
+      }
+    },
+    // 计算金额
+    computedPrice(row) {
+      let { productNumber, productUnitPrice } = row;
+      console.log(
+        "productNumber, productUnitPrice",
+        productNumber,
+        productUnitPrice
+      );
+      row.productAmounts = (
+        Number(productNumber) * Number(productUnitPrice)
+      ).toFixed(2);
+    },
+    isUpperCase(char) {
+      return char === char.toUpperCase();
+    },
+    // 下划线命名转驼峰命名
+    toUnderScoreCase(str) {
+      if (str === null) {
+        return null;
+      }
+      let sb = "";
+      // 前置字符是否大写
+      let preCharIsUpperCase = true;
+      // 当前字符是否大写
+      let curreCharIsUpperCase = true;
+      // 下一字符是否大写
+      let nexteCharIsUpperCase = true;
+      for (let i = 0; i < str.length; i++) {
+        let c = str.charAt(i);
+        if (i > 0) {
+          preCharIsUpperCase = isUpperCase(str.charAt(i - 1));
+        } else {
+          preCharIsUpperCase = false;
+        }
+
+        curreCharIsUpperCase = isUpperCase(c);
+
+        if (i < str.length - 1) {
+          nexteCharIsUpperCase = isUpperCase(str.charAt(i + 1));
+        }
+
+        if (
+          preCharIsUpperCase &&
+          curreCharIsUpperCase &&
+          !nexteCharIsUpperCase
+        ) {
+          sb += SEPARATOR;
+        } else if (i !== 0 && !preCharIsUpperCase && curreCharIsUpperCase) {
+          sb += SEPARATOR;
+        }
+        sb += c.toLowerCase();
+      }
+
+      return sb;
+    },
+    // 处理列表信息
+    columnsHandler(columns) {
+      let resArr = [];
+      console.log(columns, 111);
+      columns.forEach((item) => {
+        for (const key in item) {
+          let tempObj = {};
+          tempObj.key = camelCase(key);
+          tempObj.value = item[key];
+          resArr.push(tempObj);
+        }
+      });
+      console.log(resArr, 222);
+      return resArr;
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      // this.reset();
+    },
+    // k-form-build 取消按钮
+    kCancel() {
+      this.kOpen = false;
+      // this.reset();
+    },
+    // 分页查询
+    pageList(row) {
+      // 调用子组件-》携带子组件参数请求后台
+      this.$refs.mychild.pageList(
+        row == undefined
+          ? {
+              limit: this.queryParams.pageSize,
+              page: this.queryParams.pageNum,
+            }
+          : row
+      );
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      // this.ids = selection.map(
+      //   (item) =>
+      //     item[
+      //       camelCase(
+      //         this.tableName + "_" + this.templateInfo.template?.primaryKey
+      //       )
+      //     ]
+      // );
+      this.selection = selection;
+      this.myDelIds = selection.map((item) => item.saleOrderId);
+      console.log(this.myDelIds);
+      this.ids = selection.map((item) => item.saleOrderSaleNo);
+      this.single = selection.length != 1;
+      this.multiple = !selection.length;
+    },
+
+    // 更多操作触发
+    handleCommand(command, row) {
+      switch (command) {
+        case "handleResetPwd":
+          this.handleResetPwd(row);
+          break;
+        case "handleAuthRole":
+          this.handleAuthRole(row);
+          break;
+        default:
+          break;
+      }
+    },
+    /** 新增按钮操作 */
+    handleAdd(row) {
+      // this.reset();
+      this.defaultValue = {};
+      getInfoBySqlKey(this.templateInfo.template.sqlKey).then(({ data }) => {
+        if (!data || !data.dfVueTemplate) {
+          this.jsonData = false;
+          this.$message.error("当前表格未绑定表单!");
+          return;
+        }
+        if (data.dfFormSql) {
+          let dynamicData = JSON.parse(data.dfFormSql);
+          Object.assign(this.dynamicData, dynamicData);
+        }
+        this.jsonData = JSON.parse(data.dfVueTemplate);
+        this.open = true;
+        this.title = "添加信息";
+        this.form.password = this.initPassword;
+        this.$nextTick(() => {
+          this.$refs.addFromRef.reset();
+          inputDisableComplete();
+        });
+      });
+    },
+    longestCommonSubstring(strs) {
+      if (!strs || strs.includes("")) return "";
+      let str1_Length = strs[0].length;
+      let str_Nums = strs.length;
+      let flag = 0;
+      for (let i = 0; i < str1_Length && flag == 0; i++) {
+        let char = strs[0][i];
+        for (var j = 1; j < str_Nums; j++) {
+          if (char !== strs[j][i] || i == strs[j].length) {
+            return strs[1].substring(0, i);
+          }
+        }
+      }
+      return strs[0];
+    },
+    // 绑定dialog对话框关闭
+    handleClose() {
+      this.btnDialogVisible = false;
+    },
+    getLastUppercaseWord(text) {
+      const pattern = /\b[A-Z][a-z]*\b/g;
+      const matches = [...text.matchAll(pattern)];
+      if (matches.length > 0) {
+        const lastMatch = matches[matches.length - 1][0];
+        return lastMatch;
+      } else {
+        return null;
+      }
+    },
+    // 初始化数据
+    initData(data) {
+      let {
+        id,
+        //订单表数据
+        saleNo,
+        saleCustomNo,
+        saleDate,
+        saleOrderEstimatedTime,
+        saleLeadTime,
+        deliveryDate,
+        saleAmounts,
+        saleAmountInWords,
+        salePayType,
+        salesman,
+        customAddress,
+        customCountryType, //国家类型
+        contactPerson, //联系人
+
+        // 工艺表数据
+        remark,
+
+        // 产品列表
+        saleProductsList,
+      } = data;
+      Object.assign(this.formData, {
+        id,
+        //订单表数据
+        saleNo,
+        saleCustomNo,
+        saleDate,
+        saleOrderEstimatedTime,
+        saleLeadTime,
+        deliveryDate,
+        saleAmounts,
+        saleAmountInWords,
+        salePayType,
+        salesman,
+        customAddress,
+        customCountryType, //国家类型
+        contactPerson, //联系人
+
+        // 工艺表数据
+        orderRemark: remark,
+      });
+      this.customChangeHandler(saleCustomNo);
+      this.productionTableData = saleProductsList.map((item) => {
+        let {
+          id,
+          saleProductNo,
+          productNo, //货品编号
+          productName, //货品名称
+          productNumber, //销售数量
+          productWeight, //销售重量kg
+          productUnitPrice, //单价
+          productAmounts, //金额
+          sliceType, //切片类型  初始为  切片
+          sliceTypeLabel,
+          colourNumberLabel,
+          colourNumber, //色号
+          remark, //备注
+        } = item;
+        let productType = this.allProductionOptions.find(
+          (i) => productNo == i.productNo
+        )?.productType;
+        return {
+          id,
+          saleProductNo,
+          productNo, //货品编号
+          productType, //类型
+          productName, //货品名称
+          productNumber, //销售数量
+          productWeight, //销售重量kg
+          productUnitPrice, //单价
+          productAmounts, //金额
+          sliceType, //切片类型  初始为  切片
+          sliceTypeLabel,
+          colourNumberLabel,
+          colourNumber, //色号
+          remark,
+        };
+      });
+    },
+    /** 修改按钮操作 */
+    async handleUpdate(row) {
+      console.log(row);
+      this.isEdit = true;
+      await this.getDropDownData();
+      this.isLeader = !this.userInfo.roles.includes("salesman");
+      if (!this.isLeader) {
+        this.createById = this.userInfo.userId;
+      }
+      await this.getRoleUser();
+      this.title = "修改零售单";
+      try {
+        let res = await getRetailOrderInfo(row.id);
+        console.log(res);
+        if (res.code == 200) {
+          this.initData(res.data);
+          this.open = true;
+        } else {
+          this.$message.error(res.msg);
+        }
+      } catch (error) {
+        console.log(error);
+      }
+    },
+    //详情  打印回调
+    async handlePrint(row) {
+      await this.getDropDownData();
+      this.isLeader = !this.userInfo.roles.includes("salesman");
+      if (!this.isLeader) {
+        this.createById = this.userInfo.userId;
+      }
+      await this.getRoleUser();
+      try {
+        let res = await getRetailOrderInfo(row.id);
+        console.log(res);
+        if (res.code == 200) {
+          this.initData(res.data);
+          this.printDomData = this.getPrintDom(res.data);
+          this.detailShow = true;
+          this.$nextTick(() => {
+            this.$refs.detailTable.innerHTML = this.printDomData;
+          });
+        } else {
+          this.$message.error(res.msg);
+        }
+      } catch (error) {
+        console.log(error);
+      }
+    },
+    // 提交  回调
+    async handleSubmit(row) {
+      this.deliverShow = true;
+      this.$nextTick(() => {
+        this.$refs.deliverRef.productInvoiceInfo(row);
+      });
+    },
+    // 取消提交
+    async handleSubmitCancel(row) {
+      console.log(row);
+      this.$confirm("此操作将撤回该次提交, 是否继续?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          // this.$message({
+          //   type: 'success',
+          //   message: '删除成功!'
+          // });
+          try {
+            let { saleNo } = row;
+            let payLoad = {
+              saleOrderNo: saleNo,
+              status: 1,
+            };
+            let res = await cancelRetailOrder(payLoad);
+            if (res.code == 200) {
+              this.$message.success("取消成功");
+              this.getList();
+            } else {
+              this.$message.error("取消失败");
+              console.log(res);
+            }
+          } catch (error) {
+            console.log(error);
+          }
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "已取消",
+          });
+        });
+    },
+    // 获取打印dom
+    getPrintDom(data) {
+      let {
+        id,
+        //订单表数据
+        saleNo,
+        saleCustomNo,
+        saleDate,
+        saleOrderEstimatedTime,
+        saleLeadTime,
+        deliveryDate,
+        saleAmounts,
+        saleAmountInWords,
+        salePayType,
+        salesman,
+        customAddress,
+        customCountryType, //国家类型
+        contactPerson, //联系人
+
+        // 工艺表数据
+        orderRemark,
+      } = this.formData;
+      this.productionTableData;
+      let customData = this.customerOptions.find(
+        (item) => item.customNo == saleCustomNo
+      );
+      let customerName = customData ? customData.customName : "";
+      let printStr = `
+        <table style="width:1200px; border-collapse:collapse;" border="1" cellpadding="10" align="center">
+            <div style="text-align:center;font-size: 20px;">诸暨市新丝维纤维有限公司</div>
+            <div style="text-align:center;">销售合同审计单</div>
+            <tbody>
+                <tr>
+                    <td width="600px" colspan="4">合同号:${saleNo}</td>
+                    <td width="600px" colspan="4">日期:${saleDate.replace(
+                      "T",
+                      " "
+                    )}</td>
+                </tr>
+                <tr align="center">
+                    <td width="300px" colspan="2">客户名称:</td>
+                    <td width="300px" colspan="2">${customerName}</td>
+                    <td colspan="2">业务员:</td>
+                    <td colspan="2">${salesman}</td>
+
+                </tr>
+                <tr align="center">
+                    <td width="300px" colspan="2">客户地址:</td>
+                    <td width="300px" colspan="2">${customAddress}</td>
+                    <td width="300px" colspan="2">客户国别:</td>
+                    <td width="300px" colspan="2">${customCountryType}</td>
+                </tr>
+                <tr align="center">
+                    <td width="300px" colspan="2">联系人:</td>
+                    <td width="150px" colspan="1">${contactPerson}</td>
+                    <td  colspan="2">合计金额(大写):</td>
+                    <td colspan="3">${saleAmountInWords}</td>
+                </tr>
+                <tr align="center">
+                    <td colspan="8">货品明细</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>
+                </tr>`;
+      let amountTotal = 0,
+        singlTotal = 0,
+        moneyTotal = 0;
+      for (let i = 0; i < this.productionTableData.length; i++) {
+        let item = this.productionTableData[i];
+        amountTotal += Number(item.productNumber);
+        singlTotal += Number(item.productUnitPrice);
+        moneyTotal += Number(item.productAmounts);
+        let productData = this.productionOptions.find(
+          (pro) => pro.productNo == item.productNo
+        );
+        item.sliceTypeLabel =
+          this.sliceTypeOptions.find((k) => k.materielCode == item.sliceType)
+            ?.materielName || "";
+        item.colourNumberLabel = this.colourNumberOptions.find(
+          (k) => k.materielCode == item.colourNumber
+        )?.materieColorNumber;
+        let productName = productData ? productData.productName : "";
+        let productType = productData ? productData.productType : "";
+        printStr += `<tr align="center">
+                    <td>${productName}</td>
+                    <td>${productType}</td>
+                    <td>${item.productNumber}</td>
+                    <td>${item.productUnitPrice}</td>
+                    <td>${item.productAmounts}</td>
+                    <td>${item.sliceTypeLabel}</td>
+                    <td>${item.colourNumberLabel}</td>
+                    <td>${item.remark}</td>
+                </tr>`;
+      }
+      // 计算小计
+      amountTotal = amountTotal.toFixed(2);
+      singlTotal = singlTotal.toFixed(2);
+      moneyTotal = moneyTotal.toFixed(2);
+      printStr += `
+        <tr align="center">
+          <td>小计:</td>
+           <td></td>
+          <td>${amountTotal}</td>
+          <td>${singlTotal}</td>
+          <td>${moneyTotal}</td>
+          <td></td>
+          <td></td>
+          <td></td>
+        </tr>`;
+      printStr += `<tr align="left">
+                    <td colspan="8">订单备注:${orderRemark}</td>
+                </tr>
+                </tbody>
+        </table>`;
+      return printStr;
+    },
+    // 添加真正的字段名
+    addRealFieldName(row) {
+      let fieldList = Object.keys(row);
+      // let tableName = this.longestCommonSubstring(fieldList);
+      let tableName = camelCase(this.tableName);
+      fieldList.forEach((field) => {
+        let realField = field.replace(tableName, "");
+        realField = realField[0].toLocaleLowerCase() + realField.substring(1);
+        row[realField] = row[field];
+      });
+    },
+
+    /** 提交按钮 */
+    submitForm: function () {
+      this.$refs["form"].validate((valid) => {
+        if (valid) {
+          if (this.form.userId != undefined) {
+            updateUser(this.form).then((response) => {
+              this.$modal.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addUser(this.form).then((response) => {
+              this.$modal.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作
+     *
+     * 删除提示信息语句(标识)
+     * */
+    handleDelete(row, btnData) {
+      let delIds = this.ids;
+      let primary = camelCase(this.templateInfo.template?.primaryKey);
+      // let realyKey=
+      this.addRealFieldName(row);
+      if (row[primary] != undefined && row[primary] != null) {
+        delIds = [];
+        delIds.push(row[primary]);
+      }
+      let data = {
+        basicMap: {
+          btnType: btnData.btnType,
+          btnKey: btnData.btnKey,
+          tableName: this.tableName,
+        },
+        conditionMap: {
+          // id: delIds,
+        },
+        btnParametersMap: {},
+      };
+      if (this.currentBtnData.btnParams) {
+        let btnParams =
+          JSON.parse(this.currentBtnData.btnParams)?.commonFieldData || [];
+        let conditionData =
+          JSON.parse(this.currentBtnData.btnParams).conditionData || [];
+        conditionData.forEach((item) => {
+          data.conditionMap[item.fieldName.split(".")[1]] = item.fieldValue
+            ? item.fieldValue
+            : this.currentRow[camelCase(item.fieldName.replace(".", "_"))];
+        });
+        btnParams.forEach((item) => {
+          data.btnParametersMap[item.fieldName.split(".")[1]] = item.fieldValue
+            ? item.fieldValue
+            : this.currentRow[camelCase(item.fieldName.replace(".", "_"))];
+        });
+      }
+      // data.conditionMap[this.templateInfo.template?.primaryKey] = delIds;
+      this.$modal
+        .confirm('是否确认删除"' + delIds + '"的数据项?')
+        .then(function () {
+          // return delTableData(data);
+          return btnCommonApi(data);
+        })
+        .then(() => {
+          // 调用子组件查询方法 目的是携带上子组件中的查询参数
+          this.$refs.mychild.pageList();
+          this.$modal.msgSuccess("删除成功");
+        })
+        .catch(() => {});
+    },
+    // 批量删除接口
+    handleBatchDelete() {
+      let delIds = this.ids;
+      let primary = camelCase(this.templateInfo.template?.primaryKey);
+      // if (row && row[primary] != undefined && row[primary] != null) {
+      //   delIds = [];
+      //   delIds.push(row[primary]);
+      // }
+      let data = {
+        basicMap: {
+          tableName: this.tableName,
+        },
+        conditionMap: {
+          // id: delIds,
+        },
+      };
+      // if (this.currentBtnData.btnParams) {
+      //   let btnParams = JSON.parse(this.currentBtnData.btnParams);
+      //   btnParams.forEach((item) => {
+      //     data.btnParametersMap[
+      //       this.formatField(item.fieldName, camelCase(this.tableName))
+      //     ] = item.fieldValue
+      //       ? item.fieldValue
+      //       : this.currentRow[item.fieldName];
+      //   });
+      // }
+      data.conditionMap[this.templateInfo.template?.primaryKey] = delIds;
+      this.$modal
+        .confirm('是否确认删除"' + delIds + '"的数据项?')
+        .then(function () {
+          return delTableData(data);
+          // return btnCommonApi(data);
+        })
+        .then(() => {
+          // 调用子组件查询方法 目的是携带上子组件中的查询参数
+          this.$refs.mychild.pageList();
+          this.$modal.msgSuccess("删除成功");
+        })
+        .catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      let primary = "saleOrderId";
+      let realyKey = "saleOrderId";
+      if (this.myDelIds.length > 0) {
+        this.queryParams["execlMap"] = [];
+        this.myDelIds.forEach((item) => {
+          this.queryParams.execlMap.push(
+            this.tableList.find((ttem) => {
+              return ttem[realyKey] === item;
+            })
+          );
+        });
+      } else {
+        this.$message.warning("请至少勾选一条导出数据");
+        return;
+      }
+      this.queryParams.execlMap = JSON.stringify(this.queryParams.execlMap);
+      this.download(
+        process.env.VUE_APP_BASE_API1 + "common/export",
+        {
+          ...this.queryParams,
+        },
+        `文件名称_${new Date().getTime()}.xlsx`
+      );
+    },
+    /** 导入按钮操作 */
+    handleImport() {
+      this.upload.title = "当前导入";
+      this.upload.open = true;
+    },
+    /** 下载模板操作 */
+    importTemplate() {
+      this.download(
+        process.env.VUE_APP_BASE_API1 +
+          `common/exportTemplate?tableName=${this.tableName}&sqlkey=${this.templateInfo.template.sqlKey}`,
+        {},
+        `下载模版名称${new Date().getTime()}.xlsx`
+      );
+    },
+    // 文件上传中处理
+    handleFileUploadProgress(event, file, fileList) {
+      this.upload.isUploading = true;
+    },
+    // 文件上传成功处理
+    handleFileSuccess(response, file, fileList) {
+      this.upload.open = false;
+      this.upload.isUploading = false;
+      this.$refs.upload.clearFiles();
+      this.$alert(
+        "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
+          response.msg +
+          "</div>",
+        "导入结果",
+        { dangerouslyUseHTMLString: true }
+      );
+      this.$refs.mychild.pageList({
+        limit: this.queryParams.pageSize,
+        page: this.queryParams.pageNum,
+      });
+    },
+    //重点在这里
+    handleChange(file, fileList) {
+      file.name = this.tableName + "." + file.name.split(".")[1];
+      fileList.forEach((item) => {
+        item.name = this.tableName + "." + file.name.split(".")[1];
+      });
+      let newFile = new File(
+        [file],
+        this.tableName + "." + file.name.split(".")[1]
+      ); //创建出来也是不可编辑的file对象
+    },
+    // 提交上传文件
+    submitFileForm() {
+      this.$refs.upload.submit();
+    },
+    // 弹窗新增的数
+    addListHandler(val) {
+      this.addLists.push(...val);
+    },
+    // 绑定弹窗Dialog确定按钮
+    async btnComfirm() {
+      let res = await this.$refs.deliverRef.getAllData();
+      let { flag, isEdit, data } = res;
+      if (flag) {
+        // if (isEdit) {
+        //   //编辑
+        //   let payLoad = {
+        //     ...data.formData,
+        //     saleProductInfoList: data.tableData,
+        //   };
+        //   let res = await updateProductInvoice(payLoad);
+        //   if (res.code == 200) {
+        //     this.$message.success("修改成功");
+        //     this.deliverShow = false;
+        //     this.getList();
+        //   } else {
+        //     this.$message.error("网络异常");
+        //   }
+        // } else {
+        //新增
+        let payLoad = {
+          ...data.formData,
+          saleProductInfoList: data.tableData,
+        };
+        payLoad.status = 5;
+        // let res = await addProductInvoice(payLoad);
+        let res = await submitRetailOrder(payLoad);
+        if (res.code == 200) {
+          this.$message.success("提交成功");
+          this.deliverShow = false;
+          this.getList();
+        } else {
+          this.$message.error("网络异常");
+        }
+        // }
+      }
+    },
+    // 保存提交数据
+    async btnSave() {
+      let res = await this.$refs.deliverRef.getAllData();
+      let { flag, isEdit, data } = res;
+      if (flag) {
+        let payLoad = {
+          ...data.formData,
+          saleProductInfoList: data.tableData,
+        };
+        payLoad.status = 1;
+        let res = await updateProductInvoice(payLoad);
+        if (res.code == 200) {
+          this.$message.success("保存成功");
+          this.deliverShow = false;
+          this.getList();
+        } else {
+          this.$message.error("网络异常");
+        }
+        // }
+      }
+    },
+    // 去掉表名 开头字母小写
+    formatField(field = "", tableName) {
+      let temp = field.replace(tableName, "");
+      return toUnderline(temp[0].toLowerCase() + temp.slice(1));
+    },
+    //提交编辑结果按钮回调
+    async editConfirmHandler() {
+      if (this.$refs.addFromRef) {
+        this.$refs.addFromRef
+          .getData()
+          .then(async (values) => {
+            let data = {
+              basicMap: {
+                tableName: this.tableName,
+                // btnKey: btnData.btnKey,
+                btnKey: this.currentBtnData.btnKey,
+              },
+              addListMap: [values],
+              conditionMap: {},
+              commMap: {},
+              btnParametersMap: {},
+            };
+            if (this.currentBtnData.btnParams) {
+              let btnParams =
+                JSON.parse(this.currentBtnData.btnParams)?.commonFieldData ||
+                [];
+              let conditionData =
+                JSON.parse(this.currentBtnData.btnParams).conditionData || [];
+              // let
+              btnParams.forEach((item) => {
+                data.btnParametersMap[item.fieldName.split(".")[1]] =
+                  item.fieldValue
+                    ? item.fieldValue
+                    : this.currentRow[
+                        camelCase(item.fieldName.replace(".", "_"))
+                      ];
+              });
+              conditionData.forEach((item) => {
+                data.conditionMap[item.fieldName.split(".")[1]] =
+                  item.fieldValue
+                    ? item.fieldValue
+                    : this.currentRow[
+                        camelCase(item.fieldName.replace(".", "_"))
+                      ];
+              });
+            }
+            if (Object.keys(this.defaultValue).length) {
+              // data.conditionMap[this.templateInfo.template?.primaryKey] =
+              //   this.defaultValue[this.templateInfo.template?.primaryKey];
+              Object.keys(values).map((k) => {
+                data.commMap[k] = values[k];
+              });
+              data.basicMap.btnType = this.currentBtnData.btnType;
+              data.basicMap.visible = true;
+            } else {
+              data.basicMap.btnType = "INSERT";
+              data.basicMap.visible = true;
+            }
+            try {
+              let res = await btnCommonApi(data);
+              if (res.code == 200) {
+                this.$message.success("操作成功");
+              } else {
+                this.$message.error("网络异常,请稍后再试");
+              }
+            } catch (error) {
+              console.log(error);
+              this.$message.error("网络异常,请稍后再试");
+            }
+            this.getList();
+            this.defaultValue = {};
+            this.kOpen = false;
+          })
+          .catch((res) => {
+            console.log(res);
+            this.$modal.msgError("表单校验失败,请规范填写数据");
+          });
+      } else {
+        // 没有绑定表单
+        let data = {
+          basicMap: {
+            tableName: this.tableName,
+            // btnKey: btnData.btnKey,
+            btnKey: this.currentBtnData.btnKey,
+            btnType: this.currentBtnData.btnType,
+            visible: true,
+          },
+          addListMap: [],
+          conditionMap: {},
+          commMap: {},
+          btnParametersMap: {},
+        };
+        if (this.currentBtnData.btnParams) {
+          let btnParams =
+            JSON.parse(this.currentBtnData.btnParams)?.commonFieldData || [];
+          let conditionData =
+            JSON.parse(this.currentBtnData.btnParams).conditionData || [];
+          conditionData.forEach((item) => {
+            data.conditionMap[item.fieldName.split(".")[1]] = item.fieldValue
+              ? item.fieldValue
+              : this.currentRow[camelCase(item.fieldName.replace(".", "_"))];
+          });
+          btnParams.forEach((item) => {
+            data.btnParametersMap[item.fieldName.split(".")[1]] =
+              item.fieldValue
+                ? item.fieldValue
+                : this.currentRow[camelCase(item.fieldName.replace(".", "_"))];
+          });
+        }
+        // data.basicMap.btnType = this.currentBtnData.btnType;
+        // data.basicMap.visible = true;
+        try {
+          let res = await btnCommonApi(data);
+          if (res.code == 200) {
+            this.$message.success("操作成功");
+          } else {
+            this.$message.error("网络异常,请稍后再试");
+          }
+        } catch (error) {
+          console.log(error);
+          this.$message.error("网络异常,请稍后再试");
+        }
+        this.getList();
+        this.defaultValue = {};
+        this.kOpen = false;
+      }
+    },
+    // 使用提交数据类型的按钮获取数据
+    tempSubBtn(getData) {
+      getData()
+        .then((values) => {
+          console.log("验证通过", values);
+        })
+        .catch(() => {
+          console.log("验证未通过,获取失败");
+        });
+    },
+    // 判断是否生效行样式
+    cellStyle({ row, column, rowIndex, columnIndex }) {
+      let rowStyleList = this.styleList.filter((item) => item.styleType == 0);
+      if (!rowStyleList.length) return "";
+      let mainTableName = this.templateInfo.querySql.tableAlias; //主表名
+      for (let i = 0; i < rowStyleList.length; i++) {
+        let item = rowStyleList[i];
+        let judgeRes = this.determineCondition(item.styleCondtion, row);
+        if (judgeRes) {
+          let styleCode = JSON.parse(item.styleCode);
+          return `background-color:${styleCode.rowBgColor};`;
+        }
+      }
+    },
+
+    // 获取生效条件组结果
+    determineCondition(conditionStr, row) {
+      let conditionList = JSON.parse(conditionStr);
+      if (!conditionList.length) return false;
+      return conditionList.every((item) => this.judgeOneCondition(item, row));
+    },
+
+    // 获取单个判断条件结果
+    judgeOneCondition(item, row) {
+      let fullField = camelCase(item.tableName + "_" + item.fieldName);
+      switch (item.condition) {
+        case 1:
+          return row[fullField] > item.flagValue;
+        case 2:
+          return row[fullField] < item.flagValue;
+        case 3:
+          return row[fullField] == item.flagValue;
+        case 4:
+          return row[fullField] >= item.flagValue;
+        case 5:
+          return row[fullField] <= item.flagValue;
+        default:
+          return true; //默认为true
+      }
+    },
+
+    // 设置表格字段样式
+    async setFieldStyleData(tableList) {
+      console.log(JSON.parse(JSON.stringify(tableList)));
+      let fieldConditionList = this.styleList.filter(
+        (item) => item.styleType == 1 || item.styleType == 2
+      );
+      if (!fieldConditionList.length) return tableList;
+      let res = await this.setDictStyleData();
+
+      this.dictStyleObj = res.reduce((pre, item) => {
+        return {
+          ...pre,
+          ...item,
+        };
+      }, {});
+      // console.log("this.dictStyleObj", this.dictStyleObj);
+      tableList.forEach((row) => {
+        // if (!row.styleFieldObj) row.styleFieldObj = {};
+        for (let i = 0; i < fieldConditionList.length; i++) {
+          let item = fieldConditionList[i];
+          if (item.styleType == 1) {
+            //字段样式
+            let judgeRes = this.determineCondition(item.styleCondtion, row);
+            if (judgeRes) {
+              let styleCode = JSON.parse(item.styleCode);
+              if (!row.styleFieldObj) row.styleFieldObj = {};
+              row.styleFieldObj[item.styleField] = {
+                styleType: item.styleType,
+                fieldStyleType: styleCode.fieldStyleType,
+                fontColor: styleCode.fontColor,
+                isTagFullBg: styleCode.isTagFullBg,
+                tagType: styleCode.tagType,
+              };
+              // row.styleField = item.styleField; //样式生效字段
+              // row.styleType = item.styleType; //0:行样式 1:字段样式 2:字典样式
+              // row.fieldStyleType = styleCode.fieldStyleType; //0:文本  1:标签
+              // row.fontColor = styleCode.fontColor;
+              // row.isTagFullBg = styleCode.isTagFullBg; //true/false
+              // row.tagType = styleCode.tagType; //string
+            }
+          } else {
+            //字典样式
+            let dicStyle = this.dictStyleObj[item.styleField]?.find((dict) => {
+              return dict.dictValue == row[item.styleField];
+            });
+            if (dicStyle) {
+              if (!row.styleFieldObj) row.styleFieldObj = {};
+              row.styleFieldObj[item.styleField] = dicStyle; //设置该字段应该显示的字典样式
+              row.styleFieldObj[item.styleField].styleType = 2;
+            }
+          }
+        }
+      });
+      return tableList;
+    },
+
+    //设置表格字典相关数据
+    setDictStyleData() {
+      let fieldConditionList = this.styleList.filter(
+        (item) => item.styleType == 2
+      );
+      if (!fieldConditionList.length) return;
+      let PromiseList = fieldConditionList.map((item) => {
+        return new Promise((resolve, reject) => {
+          let temp = {};
+          try {
+            listData({
+              isEnablePaging: false,
+              dictType: item.styleCondtion,
+            }).then((res) => {
+              temp[item.styleField] = res.rows;
+              resolve(temp);
+            });
+          } catch (error) {
+            reject(error);
+          }
+        });
+      });
+      return Promise.all(PromiseList);
+    },
+
+    // 内链页面跳转
+    routerHandler(btnData, type) {
+      let { url, commonFieldData } = JSON.parse(btnData.btnParams);
+      let tempArr = [];
+      if (commonFieldData) {
+        let queryArr = JSON.parse(commonFieldData);
+
+        tempArr = queryArr.map((item) => {
+          let key = this.formatField(item.fieldName, camelCase(this.tableName));
+          let value = item.fieldValue
+            ? item.fieldValue
+            : this.currentRow[item.fieldName];
+          return key + "=" + value;
+        });
+      }
+      if (tempArr.length) {
+        url += "?" + tempArr.join("&");
+      }
+      // let link = btnData.btnParams;
+      if (type == "INNERLINK") {
+        this.$router.push(url);
+      } else {
+        window.open("http://" + url, "_blank");
+      }
+    },
+    async handleDetail(row) {
+      this.printDomData = await this.getDetailTableString(row);
+      this.detailShow = true;
+      this.$nextTick(() => {
+        this.$refs.detailTable.innerHTML = this.printDomData;
+      });
+    },
+    // 切片类型改变回调
+    sliceTypeChangeHandler(row) {
+      let { sliceType } = row;
+      if (sliceType) {
+        row.sliceTypeLabel = this.sliceTypeOptions.find(
+          (item) => item.materielCode == sliceType
+        )?.materielName;
+      }
+    },
+    // 色号改变回调
+    colourNumberChangeHandler(row) {
+      let { colourNumber } = row;
+      if (colourNumber) {
+        let target = this.colourNumberOptions.find(
+          (item) => item.materielCode == colourNumber
+        );
+        if (target) {
+          row.colourNumberLabel =
+            target.materieEncoding + target.materieColorNumber;
+        }
+        // row.colourNumberLabel = this.colourNumberOptions.find(
+        //   (item) => item.materielCode == colourNumber
+        // )?.materieColorNumber;
+      }
+    },
+    // 打印回调
+    detailPrintHandler() {
+      document.body.innerHTML = document.getElementById("printDom").innerHTML =
+        this.printDomData;
+      window.print(); //打印
+      window.location.reload();
+      return false;
+    },
+    // 根据字典value获取字典label
+    getDictLabel(value, dict) {
+      return (
+        this.dict.type[dict].find((item) => {
+          return item.value === value;
+        })?.label || ""
+      );
+    },
+    // 获取详情html字符串
+    async getDetailTableString(row) {
+      let { saleOrderSaleNo } = row;
+      let payLoad = [
+        {
+          basicMap: {
+            tableName: "sale_order",
+          },
+          conditionMap: {
+            sale_no: [saleOrderSaleNo],
+          },
+        },
+        {
+          basicMap: {
+            tableName: "sale_products",
+          },
+          conditionMap: {
+            sale_order_no: [saleOrderSaleNo],
+          },
+        },
+        {
+          basicMap: {
+            tableName: "sale_craft",
+          },
+          conditionMap: {
+            sale_order_no: [saleOrderSaleNo],
+          },
+        },
+      ];
+      let res = await queryDropDownBoxData(payLoad);
+      if (res.code == 200) {
+        console.log(res);
+        let { sale_craft, sale_order, sale_products } = res.data.resultMap;
+        let {
+          //订单表数据
+          saleNo, //合同号
+          lotNumber, //批号
+          saleCustomNo, //客户编号
+          saleDate, //销售单日期
+          saleOrderEstimatedTime, //预计下单时间
+          saleLeadTime, //交货周期
+          deliveryDate,
+          saleAmounts, //合计金额 小写
+          saleAmountInWords, //合计金额 大写
+          salePayType, //支付方式
+          earnestMoney,
+          salesman, //业务员
+          saleLeader, //业务主管
+          finance, //财务部
+          production, //生产部
+          saleApprover, //批准人
+          // customAddress, //客户地址
+          // customCountryType, //国家类型
+          // contactPerson, //联系人
+          // 货品明细表数据
+          // productNo, //货品号
+          // productName, //货品名称
+          // productNumber: "", //销售数量
+          // productWeight: "", //销售重量kg
+          // productUnitPrice: "", //单价
+          // productAmounts: "", //金额
+          // remark: "", //备注
+          // 工艺表
+          craftGrid, //网络
+          craftOil, //油剂
+          craftPackage, //卷装
+          craftColorFastness, //色牢度
+          directionOfTwist,
+          craftOther, //其它工艺要求
+          craftMark, //包装/贴唛
+          shippingMethod, //运输方式
+        } = { ...sale_craft[0], ...sale_order[0] };
+        let customData = this.customerOptions.find(
+          (item) => item.customNo == saleCustomNo
+        );
+        let payType = this.getDictLabel(salePayType, "payment_method"); //付款方式
+        let customerName = customData ? customData.customName : "";
+        let customAddress = customData?.customAddress || "无";
+        let customCountryType = customData?.customCountryType || "";
+        let contactPerson = customData?.contactPerson || "无";
+        let directionOfTwistDescription = directionOfTwist
+          ? this.getDictLabel(directionOfTwist, "direction_of_twist")
+          : "";
+        let printStr = `
+        <table style="width:1200px; border-collapse:collapse;" border="1" cellpadding="10" align="center">
+            <div style="text-align:center;font-size: 20px;">诸暨市新丝维纤维有限公司</div>
+            <div style="text-align:center;">销售合同审计单</div>
+            <tbody>
+                <tr>
+                    <td width="600px" colspan="4">合同号:${saleNo}</td>
+                    <td width="600px" colspan="4">日期:${saleDate.replace(
+                      "T",
+                      " "
+                    )}</td>
+                </tr>
+                <tr align="center">
+                    <td width="300px" colspan="2">客户名称:</td>
+                    <td width="300px" colspan="2">${customerName}</td>
+                    <td width="300px" colspan="2">联系人:</td>
+                    <td width="150px" colspan="1">${contactPerson}</td>
+                </tr>
+                <tr align="center">
+                    <td width="300px" colspan="2">客户地址:</td>
+                    <td width="300px" colspan="2">${customAddress}</td>
+                    <td width="300px" colspan="2">客户国别:</td>
+                    <td width="300px" colspan="2">${customCountryType}</td>
+                </tr>
+                <tr align="center">
+                    <td width="300px" colspan="2">预计下单时间:</td>
+                    <td  colspan="1">${saleOrderEstimatedTime.replace(
+                      "T",
+                      " "
+                    )}</td>
+                    <td  colspan="1">交货周期:</td>
+                    <td >${saleLeadTime}</td>
+                    <td  colspan="2">交货日期:</td>
+                    <td >${deliveryDate.replace("T", " ")}</td>
+                </tr>
+                <tr align="center">
+                    <td colspan="8">货品明细</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>
+                </tr>`;
+        let amountTotal = 0,
+          singlTotal = 0,
+          moneyTotal = 0;
+        for (let i = 0; i < sale_products.length; i++) {
+          let item = sale_products[i];
+          amountTotal += Number(item.productNumber);
+          singlTotal += Number(item.productUnitPrice);
+          moneyTotal += Number(item.productAmounts);
+          let productData = this.productionOptions.find(
+            (pro) => pro.productNo == item.productNo
+          );
+          console.log("item", item);
+          item.sliceTypeLabel =
+            this.sliceTypeOptions.find((k) => k.materielCode == item.sliceType)
+              ?.materielName || "";
+          item.colourNumberLabel = this.colourNumberOptions.find(
+            (k) => k.materielCode == item.colourNumber
+          )?.materieColorNumber;
+          let productName = productData ? productData.productName : "";
+          let productType = productData ? productData.productType : "";
+          printStr += `<tr align="center">
+                    <td>${productName}</td>
+                    <td>${productType}</td>
+                    <td>${item.productNumber}</td>
+                    <td>${item.productUnitPrice}</td>
+                    <td>${item.productAmounts}</td>
+                    <td>${item.sliceTypeLabel}</td>
+                    <td>${item.colourNumberLabel}</td>
+                    <td>${item.remark}</td>
+                </tr>`;
+        }
+        // 计算小计
+        printStr += `
+        <tr align="center">
+          <td>小计:</td>
+           <td></td>
+          <td>${amountTotal}</td>
+          <td>${singlTotal}</td>
+          <td>${moneyTotal}</td>
+          <td></td>
+          <td></td>
+          <td></td>
+        </tr>
+                <tr>
+                    <td colspan="8">合计金额(大写):${saleAmountInWords}</td>
+                </tr>
+                `;
+
+        if (salePayType == "1") {
+          //定金
+          printStr += `
+          <tr>
+            <td colspan="4">付款方式:${payType}</td>
+            <td colspan="4">定金:${earnestMoney}</td>
+          </tr>`;
+        } else {
+          printStr += `
+         <tr>
+              <td colspan="8">付款方式:${payType}</td>
+          </tr>`;
+        }
+        printStr += `<tr align="center">
+                    <td colspan="8">工艺要求</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>
+                </tr>
+                <tr align="center">
+                    <td >${craftGrid}</td>
+                    <td>${craftOil}</td>
+                    <td>${craftPackage}</td>
+                    <td>${craftColorFastness}</td>
+                    <td>${directionOfTwistDescription}</td>
+                    <td>${craftOther}</td>
+                    <td width="150px"></td>
+                    <td width="150px"></td>
+                </tr>
+                <tr>
+                    <td colspan="8">包装/贴唛:${craftMark}</td>
+                </tr>
+                <tr>
+                    <td colspan="8">装运方式:${shippingMethod}</td>
+                </tr>
+                <tr align="center">
+                    <td colspan="2">业务员:</td>
+                    <td colspan="2">${salesman}</td>
+                    <td colspan="2">财务部:</td>
+                    <td colspan="2">${finance}</td>
+
+                </tr>
+
+                <tr align="center">
+                    <td colspan="2">业务主管:</td>
+                    <td colspan="2">${saleApprover}</td>
+                    <td></td>
+                    <td></td>
+                    <td></td>
+                    <td></td>
+                </tr>
+            </tbody>
+        </table>
+        `;
+        return printStr;
+        // <td colspan="2">业务主管:</td>
+        // <td colspan="2">${saleLeader}</td>
+        // <tr align="center">
+
+        //     // <td colspan="2">生产部:</td>
+        //     // <td colspan="2">${production}</td>
+        // </tr>
+        //         <tr align="center">
+        //             <td colspan="2"> 2</td>
+        //             <td> </td>
+        //             <td> </td>
+        //             <td> </td>
+        //             <td> </td>
+        //         </tr>
+        //         <tr>
+        //             <td colspan="2">小计:</td>
+        //             <td></td>
+        //             <td></td>
+        //             <td></td>
+        //             <td></td>
+        //         </tr>
+      }
+    },
+    // 自定义删除按钮
+    async myDeleteHandler(row) {
+      console.log(row);
+      let stateArr = ["2", "3", "4", "5", "6", "8"];
+      let isDeleteValidate = this.selection.some((item) => {
+        return stateArr.includes(item.status);
+      });
+      console.log(this.selection);
+      console.log(isDeleteValidate);
+      if (isDeleteValidate) {
+        this.$message.error("仅允许删除订单状态为'未提交'或'未通过'的订单");
+        return;
+      }
+      await this.$confirm("是否确认删除选中的数据?", "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      });
+      let payLoad = row.saleOrderId ? [row.saleOrderId] : this.myDelIds;
+      console.log(payLoad);
+      try {
+        let res = await delOrder(payLoad);
+        if (res.code === 200) {
+          this.$message.success("删除成功");
+          this.getList();
+          this.myDelIds = [];
+          // this.$nextTick(() => {
+          //   this.$refs.tableRef?.clearSelection();
+          // });
+        } else {
+          this.$message.error(res.msg);
+        }
+      } catch (error) {}
+    },
+    // 发货回调
+    myDeliverHandler(row) {
+      this.currentRow = row;
+      this.deliverShow = true;
+      this.$nextTick(() => {
+        this.$refs.deliverRef.productInvoiceInfo(row);
+      });
     },
   },
 };
 </script>
 
-<style scoped></style>
+<style scoped lang="scss">
+::v-deep .el-dialog:not(.is-fullscreen) {
+  min-width: 610px !important;
+}
+</style>