chenjian před 1 rokem
rodič
revize
9896e374d4
100 změnil soubory, kde provedl 13017 přidání a 0 odebrání
  1. 1 0
      pom.xml
  2. 76 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/cal/CalCalendarController.java
  3. 113 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/cal/CalHolidayController.java
  4. 146 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/cal/CalPlanController.java
  5. 102 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/cal/CalPlanTeamController.java
  6. 116 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/cal/CalShiftController.java
  7. 117 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/cal/CalTeamController.java
  8. 92 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/cal/CalTeamMemberController.java
  9. 105 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/dv/DvCheckMachineryController.java
  10. 141 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/dv/DvCheckPlanController.java
  11. 106 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/dv/DvCheckSubjectController.java
  12. 111 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/dv/DvMachineryController.java
  13. 117 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/dv/DvMachineryTypeController.java
  14. 106 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/dv/DvRepairController.java
  15. 104 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/dv/DvRepairLineController.java
  16. 105 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/dv/DvSubjectController.java
  17. 138 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/md/ItemTypeController.java
  18. 135 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdClientController.java
  19. 35 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdClientMobController.java
  20. 126 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdItemController.java
  21. 36 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdItemMobController.java
  22. 108 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdProductBomController.java
  23. 32 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdProductSOPMobController.java
  24. 103 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdProductSipController.java
  25. 103 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdProductSopController.java
  26. 113 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdUnitMeasureController.java
  27. 131 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdVendorController.java
  28. 35 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdVendorMobController.java
  29. 129 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdWorkshopController.java
  30. 235 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdWorkstationController.java
  31. 116 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdWorkstationMachineController.java
  32. 110 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdWorkstationMobController.java
  33. 122 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdWorkstationToolController.java
  34. 123 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdWorkstationWorkerController.java
  35. 309 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/ProFeedbackController.java
  36. 103 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/ProProcessContentController.java
  37. 123 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/ProProcessController.java
  38. 132 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/ProRouteController.java
  39. 204 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/ProRouteProcessController.java
  40. 111 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/ProRouteProductBomController.java
  41. 150 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/ProRouteProductController.java
  42. 312 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/ProTaskController.java
  43. 98 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/ProTaskIssueController.java
  44. 103 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/ProTransConsumeController.java
  45. 112 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/ProTransOrderController.java
  46. 103 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/ProWorkorderBomController.java
  47. 265 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/ProWorkorderController.java
  48. 190 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/mobile/ProFeedBackMobController.java
  49. 49 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/mobile/ProProcessMobController.java
  50. 225 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/mobile/ProTaskIssueMobController.java
  51. 123 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/mobile/ProTaskMobController.java
  52. 148 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/mobile/ProTransOrderMobController.java
  53. 110 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/QcDefectController.java
  54. 170 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/QcDefectRecordController.java
  55. 111 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/QcIndexController.java
  56. 269 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/QcIpqcController.java
  57. 98 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/QcIpqcLineController.java
  58. 210 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/QcIqcController.java
  59. 104 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/QcIqcLineController.java
  60. 210 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/QcOqcController.java
  61. 98 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/QcOqcLineController.java
  62. 34 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/QcPendingInspectController.java
  63. 165 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/QcTemplateController.java
  64. 119 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/QcTemplateIndexController.java
  65. 105 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/QcTemplateProductController.java
  66. 47 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/mobile/QcTemplateIndexMobController.java
  67. 98 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/report/UreportFileTblController.java
  68. 130 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/tm/TmToolController.java
  69. 125 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/tm/TmToolTypeController.java
  70. 104 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmBarcodeConfigController.java
  71. 109 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmBarcodeController.java
  72. 212 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmIssueHeaderController.java
  73. 105 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmIssueLineController.java
  74. 104 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmItemConsumeController.java
  75. 104 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmItemConsumeLineController.java
  76. 237 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmItemRecptController.java
  77. 153 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmItemRecptLineController.java
  78. 97 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmMaterialStockController.java
  79. 143 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmOutsourceIssueController.java
  80. 104 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmOutsourceIssueLineController.java
  81. 179 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmOutsourceRecptController.java
  82. 155 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmOutsourceRecptLineController.java
  83. 166 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmPackageController.java
  84. 104 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmPackageLineController.java
  85. 114 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmProductProduceController.java
  86. 104 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmProductProduceLineController.java
  87. 201 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmProductRecptController.java
  88. 152 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmProductRecptLineController.java
  89. 187 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmProductSalseController.java
  90. 105 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmProductSalseLineController.java
  91. 194 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmRtIssueController.java
  92. 156 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmRtIssueLineController.java
  93. 200 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmRtSalseController.java
  94. 152 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmRtSalseLineController.java
  95. 159 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmRtVendorController.java
  96. 105 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmRtVendorLineController.java
  97. 134 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmSnController.java
  98. 164 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmStockTakingController.java
  99. 59 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmStockTakingLineController.java
  100. 104 0
      xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmStockTakingResultController.java

+ 1 - 0
pom.xml

@@ -240,6 +240,7 @@
         <module>xxgl-admin</module>
         <module>xxgl-framework</module>
         <module>xxgl-system</module>
+        <module>xxgl-mes</module>
         <!--<module>xxgl-quartz</module>-->
         <module>xxgl-generator</module>
         <module>xxgl-common</module>

+ 76 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/cal/CalCalendarController.java

@@ -0,0 +1,76 @@
+package com.miaxis.mes.controller.cal;
+
+import cn.hutool.core.collection.CollUtil;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.mes.cal.domain.CalCalendar;
+import com.miaxis.mes.cal.domain.CalHoliday;
+import com.miaxis.mes.cal.service.ICalCalendarService;
+import com.miaxis.mes.cal.service.ICalHolidayService;
+import com.miaxis.mes.cal.utils.CalendarUtil;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Date;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 排班日历
+ *
+ * @author yinjinlu
+ * @date 2022-06-10
+ */
+@RestController
+@RequestMapping("/mes/cal/calendar")
+public class CalCalendarController extends BaseController {
+
+    @Autowired
+    private ICalCalendarService calCalendarService;
+
+    @Autowired
+    private ICalHolidayService calHolidayService;
+
+    @PreAuthorize("@ss.hasPermi('mes:cal:calendar:list')")
+    @GetMapping("/list")
+    public Response getCalendars(CalCalendar calCalendar){
+
+        Date day = calCalendar.getDate();
+        List<CalCalendar> days = null;
+        if(StringUtils.isNull(day)){
+            day = new Date();
+        }
+
+        if(UserConstants.CAL_QUERY_BY_TYPE.equals(calCalendar.getQueryType())){
+            days=calCalendarService.getCalendarByType(day,calCalendar.getCalendarType());
+        }else if(UserConstants.CAL_QUERY_BY_TEAM.equals(calCalendar.getQueryType())){
+            days=calCalendarService.getCalendarByTeam(day,calCalendar.getTeamId());
+        }else {
+            days=calCalendarService.getCalendarByUser(day,calCalendar.getUserId());
+        }
+        return Response.success(getCalendarsWithoutHoliday(days));
+    }
+
+
+    /**
+     * 过滤掉节假日
+     * @param days
+     * @return
+     */
+    private List<CalCalendar> getCalendarsWithoutHoliday(List<CalCalendar> days){
+        CalHoliday param = new CalHoliday();
+        List<CalHoliday> holidays = calHolidayService.selectCalHolidayList(param);
+        if(CollUtil.isNotEmpty(holidays)){
+            List<CalCalendar> results = days.stream().filter(
+                    calCalendar -> holidays.stream().filter(calHoliday -> calCalendar.getTheDay().equals(CalendarUtil.getDateStr(calHoliday.getTheDay()))).collect(Collectors.toList()).size()==0
+            ).collect(Collectors.toList());
+            return results;
+        }
+        return days;
+    }
+}

+ 113 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/cal/CalHolidayController.java

@@ -0,0 +1,113 @@
+package com.miaxis.mes.controller.cal;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import cn.hutool.core.collection.CollUtil;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.cal.domain.CalHoliday;
+import com.miaxis.mes.cal.service.ICalHolidayService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 节假日设置Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-06-08
+ */
+@RestController
+@RequestMapping("/mes/cal/calholiday")
+public class CalHolidayController extends BaseController
+{
+    @Autowired
+    private ICalHolidayService calHolidayService;
+
+    /**
+     * 查询节假日设置列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:calholiday:list')")
+    @GetMapping("/list")
+    public Response list(CalHoliday calHoliday)
+    {
+        List<CalHoliday> list = calHolidayService.selectCalHolidayList(calHoliday);
+        return Response.success(list);
+    }
+
+    /**
+     * 导出节假日设置列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:calholiday:export')")
+    @Log(title = "节假日设置", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, CalHoliday calHoliday)
+    {
+        List<CalHoliday> list = calHolidayService.selectCalHolidayList(calHoliday);
+        ExcelUtil<CalHoliday> util = new ExcelUtil<CalHoliday>(CalHoliday.class);
+        return util.exportExcel( list, "节假日设置数据");
+    }
+
+    /**
+     * 获取节假日设置详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:calholiday:query')")
+    @GetMapping(value = "/{holidayId}")
+    public Response getInfo(@PathVariable("holidayId") Long holidayId)
+    {
+        return Response.success(calHolidayService.selectCalHolidayByHolidayId(holidayId));
+    }
+
+    /**
+     * 新增节假日设置
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:calholiday:add')")
+    @Log(title = "节假日设置", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody CalHoliday calHoliday)
+    {
+        CalHoliday param = new CalHoliday();
+        param.setTheDay(calHoliday.getTheDay());
+        List<CalHoliday> days = calHolidayService.selectCalHolidayList(param);
+        if(CollUtil.isNotEmpty(days)){
+            calHoliday.setHolidayId(days.get(0).getHolidayId());
+            return toResponse(calHolidayService.updateCalHoliday(calHoliday));
+        }else{
+            return toResponse(calHolidayService.insertCalHoliday(calHoliday));
+        }
+    }
+
+    /**
+     * 修改节假日设置
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:calholiday:edit')")
+    @Log(title = "节假日设置", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody CalHoliday calHoliday)
+    {
+        return toResponse(calHolidayService.updateCalHoliday(calHoliday));
+    }
+
+    /**
+     * 删除节假日设置
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:calholiday:remove')")
+    @Log(title = "节假日设置", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{holidayIds}")
+    public Response remove(@PathVariable Long[] holidayIds)
+    {
+        return toResponse(calHolidayService.deleteCalHolidayByHolidayIds(holidayIds));
+    }
+}

+ 146 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/cal/CalPlanController.java

@@ -0,0 +1,146 @@
+package com.miaxis.mes.controller.cal;
+
+import cn.hutool.core.collection.CollectionUtil;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.cal.domain.CalPlan;
+import com.miaxis.mes.cal.domain.CalPlanTeam;
+import com.miaxis.mes.cal.service.ICalPlanService;
+import com.miaxis.mes.cal.service.ICalPlanTeamService;
+import com.miaxis.mes.cal.service.ICalShiftService;
+import com.miaxis.mes.cal.service.ICalTeamshiftService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 排班计划Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-06-06
+ */
+@RestController
+@RequestMapping("/mes/cal/calplan")
+public class CalPlanController extends BaseController
+{
+    @Autowired
+    private ICalPlanService calPlanService;
+
+    @Autowired
+    private ICalShiftService calShiftService;
+
+    @Autowired
+    private ICalPlanTeamService calPlanTeamService;
+
+    @Autowired
+    private ICalTeamshiftService calTeamshiftService;
+
+    /**
+     * 查询排班计划列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:calplan:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(CalPlan calPlan)
+    {
+        startPage();
+        List<CalPlan> list = calPlanService.selectCalPlanList(calPlan);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出排班计划列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:calplan:export')")
+    @Log(title = "排班计划", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, CalPlan calPlan)
+    {
+        List<CalPlan> list = calPlanService.selectCalPlanList(calPlan);
+        ExcelUtil<CalPlan> util = new ExcelUtil<CalPlan>(CalPlan.class);
+        return util.exportExcel( list, "排班计划数据");
+    }
+
+    /**
+     * 获取排班计划详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:calplan:query')")
+    @GetMapping(value = "/{planId}")
+    public Response getInfo(@PathVariable("planId") Long planId)
+    {
+        return Response.success(calPlanService.selectCalPlanByPlanId(planId));
+    }
+
+    /**
+     * 新增排班计划
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:calplan:add')")
+    @Log(title = "排班计划", businessType = BusinessTypeEnum.INSERT)
+    @Transactional
+    @PostMapping
+    public Response add(@RequestBody CalPlan calPlan)
+    {
+        int ret = calPlanService.insertCalPlan(calPlan);
+        //根据选择的轮班方式生成默认的班次
+        calShiftService.addDefaultShift(calPlan.getPlanId(),calPlan.getShiftType());
+        return toResponse(ret);
+    }
+
+
+    /**
+     * 修改排班计划
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:calplan:edit')")
+    @Log(title = "排班计划", businessType = BusinessTypeEnum.UPDATE)
+    @Transactional
+    @PutMapping
+    public Response edit(@RequestBody CalPlan calPlan)
+    {
+        if(UserConstants.ORDER_STATUS_CONFIRMED.equals(calPlan.getStatus())){
+
+            //检查班组配置
+            List<CalPlanTeam> teams = calPlanTeamService.selectCalPlanTeamListByPlanId(calPlan.getPlanId());
+            if(CollectionUtil.isEmpty(teams)){
+                throw new CustomException("请配置班组!");
+            } else if(teams.size() != 2 && UserConstants.CAL_SHIFT_TYPE_TWO.equals(calPlan.getShiftType())){
+                throw new CustomException("两班倒请配置两个班组!");
+            } else if(teams.size() !=3 && UserConstants.CAL_SHIFT_TYPE_THREE.equals(calPlan.getShiftType())){
+                throw new CustomException("三倒请配置三个班组!");
+            }
+
+            calTeamshiftService.genRecords(calPlan.getPlanId());
+        }
+        return toResponse(calPlanService.updateCalPlan(calPlan));
+    }
+
+    /**
+     * 删除排班计划
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:calplan:remove')")
+    @Log(title = "排班计划", businessType = BusinessTypeEnum.DELETE)
+    @Transactional
+	@DeleteMapping("/{planIds}")
+    public Response remove(@PathVariable Long[] planIds)
+    {
+        for (Long planId:planIds
+             ) {
+            //状态判断
+            CalPlan plan = calPlanService.selectCalPlanByPlanId(planId);
+            if(!UserConstants.ORDER_STATUS_PREPARE.equals(plan.getStatus())){
+                throw new CustomException("只能删除草稿状态单据!");
+            }
+            calShiftService.deleteByPlanId(planId);
+            calPlanTeamService.deleteByPlanId(planId);
+        }
+        return toResponse(calPlanService.deleteCalPlanByPlanIds(planIds));
+    }
+}

+ 102 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/cal/CalPlanTeamController.java

@@ -0,0 +1,102 @@
+package com.miaxis.mes.controller.cal;
+
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.cal.domain.CalPlanTeam;
+import com.miaxis.mes.cal.service.ICalPlanTeamService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 计划班组Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-06-07
+ */
+@RestController
+@RequestMapping("/mes/cal/planteam")
+public class CalPlanTeamController extends BaseController
+{
+    @Autowired
+    private ICalPlanTeamService calPlanTeamService;
+
+    /**
+     * 查询计划班组列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(CalPlanTeam calPlanTeam)
+    {
+        startPage();
+        List<CalPlanTeam> list = calPlanTeamService.selectCalPlanTeamList(calPlanTeam);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出计划班组列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:calplan:export')")
+    @Log(title = "计划班组", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, CalPlanTeam calPlanTeam)
+    {
+        List<CalPlanTeam> list = calPlanTeamService.selectCalPlanTeamList(calPlanTeam);
+        ExcelUtil<CalPlanTeam> util = new ExcelUtil<CalPlanTeam>(CalPlanTeam.class);
+        return util.exportExcel( list, "计划班组数据");
+    }
+
+    /**
+     * 获取计划班组详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:calplan:query')")
+    @GetMapping(value = "/{recordId}")
+    public Response getInfo(@PathVariable("recordId") Long recordId)
+    {
+        return Response.success(calPlanTeamService.selectCalPlanTeamByRecordId(recordId));
+    }
+
+    /**
+     * 新增计划班组
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:calplan:add')")
+    @Log(title = "计划班组", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody CalPlanTeam calPlanTeam)
+    {
+        if (UserConstants.NOT_UNIQUE.equals(calPlanTeamService.checkPlanTeamUnique(calPlanTeam))) {
+            throw new CustomException("班组已添加,不能重复添加!");
+        }
+        return toResponse(calPlanTeamService.insertCalPlanTeam(calPlanTeam));
+    }
+
+    /**
+     * 修改计划班组
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:calplan:edit')")
+    @Log(title = "计划班组", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody CalPlanTeam calPlanTeam)
+    {
+        return toResponse(calPlanTeamService.updateCalPlanTeam(calPlanTeam));
+    }
+
+    /**
+     * 删除计划班组
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:calplan:remove')")
+    @Log(title = "计划班组", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{recordIds}")
+    public Response remove(@PathVariable Long[] recordIds)
+    {
+        return toResponse(calPlanTeamService.deleteCalPlanTeamByRecordIds(recordIds));
+    }
+}

+ 116 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/cal/CalShiftController.java

@@ -0,0 +1,116 @@
+package com.miaxis.mes.controller.cal;
+
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.cal.domain.CalPlan;
+import com.miaxis.mes.cal.domain.CalShift;
+import com.miaxis.mes.cal.service.ICalPlanService;
+import com.miaxis.mes.cal.service.ICalShiftService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 计划班次Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-06-06
+ */
+@RestController
+@RequestMapping("/mes/cal/shift")
+public class CalShiftController extends BaseController
+{
+    @Autowired
+    private ICalShiftService calShiftService;
+
+    @Autowired
+    private ICalPlanService calPlanService;
+
+    /**
+     * 查询计划班次列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(CalShift calShift)
+    {
+        startPage();
+        List<CalShift> list = calShiftService.selectCalShiftList(calShift);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出计划班次列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:calplan:export')")
+    @Log(title = "计划班次", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, CalShift calShift)
+    {
+        List<CalShift> list = calShiftService.selectCalShiftList(calShift);
+        ExcelUtil<CalShift> util = new ExcelUtil<CalShift>(CalShift.class);
+        return util.exportExcel( list, "计划班次数据");
+    }
+
+    /**
+     * 获取计划班次详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:calplan:query')")
+    @GetMapping(value = "/{shiftId}")
+    public Response getInfo(@PathVariable("shiftId") Long shiftId)
+    {
+        return Response.success(calShiftService.selectCalShiftByShiftId(shiftId));
+    }
+
+    /**
+     * 新增计划班次
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:calplan:add')")
+    @Log(title = "计划班次", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody CalShift calShift)
+    {
+        int count = calShiftService.checkShiftCount(calShift.getPlanId());
+        CalPlan plan = calPlanService.selectCalPlanByPlanId(calShift.getPlanId());
+        if(UserConstants.CAL_SHIFT_TYPE_SINGLE.equals(plan.getShiftType())&&count>0){
+            throw new CustomException("轮班方式为 白班 时只能有一个班次!");
+        }
+        if(UserConstants.CAL_SHIFT_TYPE_TWO.equals(plan.getShiftType())&&count>1){
+            throw new CustomException("轮班方式为 两班倒 时只能有两个班次!");
+        }
+        if(UserConstants.CAL_SHIFT_TYPE_THREE.equals(plan.getShiftType())&&count>2){
+            throw new CustomException("轮班方式为 三班倒 时只能有三个班次!");
+        }
+
+        return toResponse(calShiftService.insertCalShift(calShift));
+    }
+
+    /**
+     * 修改计划班次
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:calplan:edit')")
+    @Log(title = "计划班次", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody CalShift calShift)
+    {
+        return toResponse(calShiftService.updateCalShift(calShift));
+    }
+
+    /**
+     * 删除计划班次
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:calplan:remove')")
+    @Log(title = "计划班次", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{shiftIds}")
+    public Response remove(@PathVariable Long[] shiftIds)
+    {
+        return toResponse(calShiftService.deleteCalShiftByShiftIds(shiftIds));
+    }
+}

+ 117 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/cal/CalTeamController.java

@@ -0,0 +1,117 @@
+package com.miaxis.mes.controller.cal;
+
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.cal.domain.CalTeam;
+import com.miaxis.mes.cal.service.ICalTeamMemberService;
+import com.miaxis.mes.cal.service.ICalTeamService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 班组Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-06-05
+ */
+@RestController
+@RequestMapping("/mes/cal/team")
+public class CalTeamController extends BaseController
+{
+    @Autowired
+    private ICalTeamService calTeamService;
+
+    @Autowired
+    private ICalTeamMemberService calTeamMemberService;
+
+    /**
+     * 查询班组列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(CalTeam calTeam)
+    {
+        startPage();
+        List<CalTeam> list = calTeamService.selectCalTeamList(calTeam);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 查询所有班组列表
+     */
+    @GetMapping("/listAll")
+    public Response listAll(){
+        CalTeam  calTeam= new CalTeam();
+        List<CalTeam> list = calTeamService.selectCalTeamList(calTeam);
+        return Response.success(list);
+    }
+
+    /**
+     * 导出班组列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:team:export')")
+    @Log(title = "班组", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, CalTeam calTeam)
+    {
+        List<CalTeam> list = calTeamService.selectCalTeamList(calTeam);
+        ExcelUtil<CalTeam> util = new ExcelUtil<CalTeam>(CalTeam.class);
+        return util.exportExcel( list, "班组数据");
+    }
+
+    /**
+     * 获取班组详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:team:query')")
+    @GetMapping(value = "/{teamId}")
+    public Response getInfo(@PathVariable("teamId") Long teamId)
+    {
+        return Response.success(calTeamService.selectCalTeamByTeamId(teamId));
+    }
+
+    /**
+     * 新增班组
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:team:add')")
+    @Log(title = "班组", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody CalTeam calTeam)
+    {
+        return toResponse(calTeamService.insertCalTeam(calTeam));
+    }
+
+    /**
+     * 修改班组
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:team:edit')")
+    @Log(title = "班组", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody CalTeam calTeam)
+    {
+        return toResponse(calTeamService.updateCalTeam(calTeam));
+    }
+
+    /**
+     * 删除班组
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:team:remove')")
+    @Log(title = "班组", businessType = BusinessTypeEnum.DELETE)
+    @Transactional
+	@DeleteMapping("/{teamIds}")
+    public Response remove(@PathVariable Long[] teamIds)
+    {
+        for (Long teamId:teamIds
+             ) {
+            calTeamMemberService.deleteByTeamId(teamId);
+        }
+        return toResponse(calTeamService.deleteCalTeamByTeamIds(teamIds));
+    }
+}

+ 92 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/cal/CalTeamMemberController.java

@@ -0,0 +1,92 @@
+package com.miaxis.mes.controller.cal;
+
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.cal.domain.CalTeamMember;
+import com.miaxis.mes.cal.service.ICalTeamMemberService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 班组成员Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-06-05
+ */
+@RestController
+@RequestMapping("/mes/cal/teammember")
+public class CalTeamMemberController extends BaseController
+{
+    @Autowired
+    private ICalTeamMemberService calTeamMemberService;
+
+    /**
+     * 查询班组成员列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(CalTeamMember calTeamMember)
+    {
+        startPage();
+        List<CalTeamMember> list = calTeamMemberService.selectCalTeamMemberList(calTeamMember);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出班组成员列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:team:export')")
+    @Log(title = "班组成员", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, CalTeamMember calTeamMember)
+    {
+        List<CalTeamMember> list = calTeamMemberService.selectCalTeamMemberList(calTeamMember);
+        ExcelUtil<CalTeamMember> util = new ExcelUtil<CalTeamMember>(CalTeamMember.class);
+        return util.exportExcel( list, "班组成员数据");
+    }
+
+    /**
+     * 获取班组成员详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:team:query')")
+    @GetMapping(value = "/{memberId}")
+    public Response getInfo(@PathVariable("memberId") Long memberId)
+    {
+        return Response.success(calTeamMemberService.selectCalTeamMemberByMemberId(memberId));
+    }
+
+    /**
+     * 新增班组成员
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:team:add')")
+    @Log(title = "班组成员", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody CalTeamMember calTeamMember)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(calTeamMemberService.checkUserUnique(calTeamMember))){
+            throw new CustomException("用户"+calTeamMember.getNickName()+"已分配过班组!");
+        }
+
+        return toResponse(calTeamMemberService.insertCalTeamMember(calTeamMember));
+    }
+
+    /**
+     * 删除班组成员
+     */
+    @PreAuthorize("@ss.hasPermi('mes:cal:team:remove')")
+    @Log(title = "班组成员", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{memberIds}")
+    public Response remove(@PathVariable Long[] memberIds)
+    {
+        return toResponse(calTeamMemberService.deleteCalTeamMemberByMemberIds(memberIds));
+    }
+}

+ 105 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/dv/DvCheckMachineryController.java

@@ -0,0 +1,105 @@
+package com.miaxis.mes.controller.dv;
+
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.dv.domain.DvCheckMachinery;
+import com.miaxis.mes.dv.service.IDvCheckMachineryService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 点检设备Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-06-17
+ */
+@RestController
+@RequestMapping("/mes/dv/checkmachinery")
+public class DvCheckMachineryController extends BaseController
+{
+    @Autowired
+    private IDvCheckMachineryService dvCheckMachineryService;
+
+    /**
+     * 查询点检设备列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(DvCheckMachinery dvCheckMachinery)
+    {
+        startPage();
+        List<DvCheckMachinery> list = dvCheckMachineryService.selectDvCheckMachineryList(dvCheckMachinery);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出点检设备列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:export')")
+    @Log(title = "点检设备", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, DvCheckMachinery dvCheckMachinery)
+    {
+        List<DvCheckMachinery> list = dvCheckMachineryService.selectDvCheckMachineryList(dvCheckMachinery);
+        ExcelUtil<DvCheckMachinery> util = new ExcelUtil<DvCheckMachinery>(DvCheckMachinery.class);
+        return util.exportExcel( list, "点检设备数据");
+    }
+
+    /**
+     * 获取点检设备详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:query')")
+    @GetMapping(value = "/{recordId}")
+    public Response getInfo(@PathVariable("recordId") Long recordId)
+    {
+        return Response.success(dvCheckMachineryService.selectDvCheckMachineryByRecordId(recordId));
+    }
+
+    /**
+     * 新增点检设备
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:add')")
+    @Log(title = "点检设备", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody DvCheckMachinery dvCheckMachinery)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(dvCheckMachineryService.checkMachineryUnique(dvCheckMachinery))){
+            throw new CustomException("设备已设置过点检计划!");
+        }
+        return toResponse(dvCheckMachineryService.insertDvCheckMachinery(dvCheckMachinery));
+    }
+
+    /**
+     * 修改点检设备
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:edit')")
+    @Log(title = "点检设备", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody DvCheckMachinery dvCheckMachinery)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(dvCheckMachineryService.checkMachineryUnique(dvCheckMachinery))){
+            throw new CustomException("设备已设置过点检计划!");
+        }
+        return toResponse(dvCheckMachineryService.updateDvCheckMachinery(dvCheckMachinery));
+    }
+
+    /**
+     * 删除点检设备
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:remove')")
+    @Log(title = "点检设备", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{recordIds}")
+    public Response remove(@PathVariable Long[] recordIds)
+    {
+        return toResponse(dvCheckMachineryService.deleteDvCheckMachineryByRecordIds(recordIds));
+    }
+}

+ 141 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/dv/DvCheckPlanController.java

@@ -0,0 +1,141 @@
+package com.miaxis.mes.controller.dv;
+
+import cn.hutool.core.collection.CollUtil;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.dv.domain.DvCheckMachinery;
+import com.miaxis.mes.dv.domain.DvCheckPlan;
+import com.miaxis.mes.dv.domain.DvCheckSubject;
+import com.miaxis.mes.dv.service.IDvCheckMachineryService;
+import com.miaxis.mes.dv.service.IDvCheckPlanService;
+import com.miaxis.mes.dv.service.IDvCheckSubjectService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 设备点检计划头Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-06-16
+ */
+@RestController
+@RequestMapping("/mes/dv/checkplan")
+public class DvCheckPlanController extends BaseController
+{
+    @Autowired
+    private IDvCheckPlanService dvCheckPlanService;
+
+    @Autowired
+    IDvCheckMachineryService dvCheckMachineryService;
+
+    @Autowired
+    IDvCheckSubjectService dvCheckSubjectService;
+
+    /**
+     * 查询设备点检计划头列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(DvCheckPlan dvCheckPlan)
+    {
+        startPage();
+        List<DvCheckPlan> list = dvCheckPlanService.selectDvCheckPlanList(dvCheckPlan);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出设备点检计划头列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:export')")
+    @Log(title = "设备点检计划头", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, DvCheckPlan dvCheckPlan)
+    {
+        List<DvCheckPlan> list = dvCheckPlanService.selectDvCheckPlanList(dvCheckPlan);
+        ExcelUtil<DvCheckPlan> util = new ExcelUtil<DvCheckPlan>(DvCheckPlan.class);
+        return util.exportExcel( list, "设备点检计划头数据");
+    }
+
+    /**
+     * 获取设备点检计划头详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:query')")
+    @GetMapping(value = "/{planId}")
+    public Response getInfo(@PathVariable("planId") Long planId)
+    {
+        return Response.success(dvCheckPlanService.selectDvCheckPlanByPlanId(planId));
+    }
+
+    /**
+     * 新增设备点检计划头
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:add')")
+    @Log(title = "设备点检计划头", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody DvCheckPlan dvCheckPlan)
+    {
+        return toResponse(dvCheckPlanService.insertDvCheckPlan(dvCheckPlan));
+    }
+
+    /**
+     * 修改设备点检计划头
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:edit')")
+    @Log(title = "设备点检计划头", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody DvCheckPlan dvCheckPlan)
+    {
+        if(UserConstants.ORDER_STATUS_FINISHED.equals(dvCheckPlan.getStatus())){
+            DvCheckMachinery para1 = new DvCheckMachinery();
+            para1.setPlanId(dvCheckPlan.getPlanId());
+            List<DvCheckMachinery> machinerys = dvCheckMachineryService.selectDvCheckMachineryList(para1);
+            if(!CollUtil.isNotEmpty(machinerys)){
+                throw new CustomException("请指定设备!");
+            }
+
+            DvCheckSubject para2 = new DvCheckSubject();
+            para2.setPlanId(dvCheckPlan.getPlanId());
+            List<DvCheckSubject> subjects = dvCheckSubjectService.selectDvCheckSubjectList(para2);
+            if(!CollUtil.isNotEmpty(subjects)){
+                throw new CustomException("请指定项目!");
+            }
+        }
+        return toResponse(dvCheckPlanService.updateDvCheckPlan(dvCheckPlan));
+    }
+
+    /**
+     * 删除设备点检计划头
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:remove')")
+    @Log(title = "设备点检计划头", businessType = BusinessTypeEnum.DELETE)
+    @Transactional
+	@DeleteMapping("/{planIds}")
+    public Response remove(@PathVariable Long[] planIds)
+    {
+        for (Long planId:planIds
+             ) {
+            DvCheckPlan plan = dvCheckPlanService.selectDvCheckPlanByPlanId(planId);
+            if(!UserConstants.ORDER_STATUS_PREPARE.equals(plan.getStatus())){
+                throw new CustomException("只能删除草稿状态单据!");
+            }
+
+            dvCheckMachineryService.deleteByPlanId(planId);
+            dvCheckSubjectService.deleteByPlanId(planId);
+        }
+
+
+
+        return toResponse(dvCheckPlanService.deleteDvCheckPlanByPlanIds(planIds));
+    }
+}

+ 106 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/dv/DvCheckSubjectController.java

@@ -0,0 +1,106 @@
+package com.miaxis.mes.controller.dv;
+
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.dv.domain.DvCheckSubject;
+import com.miaxis.mes.dv.service.IDvCheckSubjectService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 点检项目Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-06-18
+ */
+@RestController
+@RequestMapping("/mes/dv/checksubject")
+public class DvCheckSubjectController extends BaseController
+{
+    @Autowired
+    private IDvCheckSubjectService dvCheckSubjectService;
+
+    /**
+     * 查询点检项目列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(DvCheckSubject dvCheckSubject)
+    {
+        startPage();
+        List<DvCheckSubject> list = dvCheckSubjectService.selectDvCheckSubjectList(dvCheckSubject);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出点检项目列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:export')")
+    @Log(title = "点检项目", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, DvCheckSubject dvCheckSubject)
+    {
+        List<DvCheckSubject> list = dvCheckSubjectService.selectDvCheckSubjectList(dvCheckSubject);
+        ExcelUtil<DvCheckSubject> util = new ExcelUtil<DvCheckSubject>(DvCheckSubject.class);
+        return util.exportExcel( list, "点检项目数据");
+    }
+
+    /**
+     * 获取点检项目详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:query')")
+    @GetMapping(value = "/{recordId}")
+    public Response getInfo(@PathVariable("recordId") Long recordId)
+    {
+        return Response.success(dvCheckSubjectService.selectDvCheckSubjectByRecordId(recordId));
+    }
+
+    /**
+     * 新增点检项目
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:add')")
+    @Log(title = "点检项目", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody DvCheckSubject dvCheckSubject)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(dvCheckSubjectService.checkSubjectUnique(dvCheckSubject))){
+            throw new CustomException("点检项目已经添加过!");
+        }
+
+        return toResponse(dvCheckSubjectService.insertDvCheckSubject(dvCheckSubject));
+    }
+
+    /**
+     * 修改点检项目
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:edit')")
+    @Log(title = "点检项目", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody DvCheckSubject dvCheckSubject)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(dvCheckSubjectService.checkSubjectUnique(dvCheckSubject))){
+            throw new CustomException("点检项目已经添加过!");
+        }
+        return toResponse(dvCheckSubjectService.updateDvCheckSubject(dvCheckSubject));
+    }
+
+    /**
+     * 删除点检项目
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:remove')")
+    @Log(title = "点检项目", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{recordIds}")
+    public Response remove(@PathVariable Long[] recordIds)
+    {
+        return toResponse(dvCheckSubjectService.deleteDvCheckSubjectByRecordIds(recordIds));
+    }
+}

+ 111 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/dv/DvMachineryController.java

@@ -0,0 +1,111 @@
+package com.miaxis.mes.controller.dv;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.mes.wm.utils.WmBarCodeUtil;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.dv.domain.DvMachinery;
+import com.miaxis.mes.dv.service.IDvMachineryService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 设备Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-08
+ */
+@RestController
+@RequestMapping("/mes/dv/machinery")
+public class DvMachineryController extends BaseController
+{
+    @Autowired
+    private IDvMachineryService dvMachineryService;
+
+    @Autowired
+    private WmBarCodeUtil wmBarCodeUtil;
+
+    /**
+     * 查询设备列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(DvMachinery dvMachinery)
+    {
+        startPage();
+        List<DvMachinery> list = dvMachineryService.selectDvMachineryList(dvMachinery);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出设备列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:machinery:export')")
+    @Log(title = "设备", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, DvMachinery dvMachinery)
+    {
+        List<DvMachinery> list = dvMachineryService.selectDvMachineryList(dvMachinery);
+        ExcelUtil<DvMachinery> util = new ExcelUtil<DvMachinery>(DvMachinery.class);
+        return util.exportExcel( list, "设备数据");
+    }
+
+    /**
+     * 获取设备详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:machinery:query')")
+    @GetMapping(value = "/{machineryId}")
+    public Response getInfo(@PathVariable("machineryId") Long machineryId)
+    {
+        return Response.success(dvMachineryService.selectDvMachineryByMachineryId(machineryId));
+    }
+
+    /**
+     * 新增设备
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:machinery:add')")
+    @Log(title = "设备", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody DvMachinery dvMachinery)
+    {
+        dvMachineryService.insertDvMachinery(dvMachinery);
+        wmBarCodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_MACHINERY,dvMachinery.getMachineryId(),dvMachinery.getMachineryCode(),dvMachinery.getMachineryName());
+        return Response.success(dvMachinery.getMachineryId());
+    }
+
+    /**
+     * 修改设备
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:machinery:edit')")
+    @Log(title = "设备", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody DvMachinery dvMachinery)
+    {
+        return toResponse(dvMachineryService.updateDvMachinery(dvMachinery));
+    }
+
+    /**
+     * 删除设备
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:machinery:remove')")
+    @Log(title = "设备", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{machineryIds}")
+    public Response remove(@PathVariable Long[] machineryIds)
+    {
+        return toResponse(dvMachineryService.deleteDvMachineryByMachineryIds(machineryIds));
+    }
+}

+ 117 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/dv/DvMachineryTypeController.java

@@ -0,0 +1,117 @@
+package com.miaxis.mes.controller.dv;
+
+import cn.hutool.core.collection.CollUtil;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.dv.domain.DvMachinery;
+import com.miaxis.mes.dv.domain.DvMachineryType;
+import com.miaxis.mes.dv.service.IDvMachineryService;
+import com.miaxis.mes.dv.service.IDvMachineryTypeService;
+import com.miaxis.system.strategy.AutoCodeUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 设备类型Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-08
+ */
+@RestController
+@RequestMapping("/mes/dv/machinerytype")
+public class DvMachineryTypeController extends BaseController
+{
+    @Autowired
+    private IDvMachineryTypeService dvMachineryTypeService;
+
+    @Autowired
+    private IDvMachineryService dvMachineryService;
+
+    @Autowired
+    private AutoCodeUtil autoCodeUtil;
+    /**
+     * 查询设备类型列表
+     */
+    @GetMapping("/list")
+    public Response list(DvMachineryType dvMachineryType)
+    {
+        List<DvMachineryType> list = dvMachineryTypeService.selectDvMachineryTypeList(dvMachineryType);
+        return Response.success(list);
+    }
+
+    /**
+     * 导出设备类型列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:machinerytype:export')")
+    @Log(title = "设备类型", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, DvMachineryType dvMachineryType)
+    {
+        List<DvMachineryType> list = dvMachineryTypeService.selectDvMachineryTypeList(dvMachineryType);
+        ExcelUtil<DvMachineryType> util = new ExcelUtil<DvMachineryType>(DvMachineryType.class);
+        return util.exportExcel( list, "设备类型数据");
+    }
+
+    /**
+     * 获取设备类型详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:machinerytype:query')")
+    @GetMapping(value = "/{machineryTypeId}")
+    public Response getInfo(@PathVariable("machineryTypeId") Long machineryTypeId)
+    {
+        return Response.success(dvMachineryTypeService.selectDvMachineryTypeByMachineryTypeId(machineryTypeId));
+    }
+
+    /**
+     * 新增设备类型
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:machinerytype:add')")
+    @Log(title = "设备类型", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody DvMachineryType dvMachineryType)
+    {
+        dvMachineryType.setMachineryTypeCode(autoCodeUtil.genSerialCode(UserConstants.MACHINERY_TYPE_CODE,null));
+        return toResponse(dvMachineryTypeService.insertDvMachineryType(dvMachineryType));
+    }
+
+    /**
+     * 修改设备类型
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:machinerytype:edit')")
+    @Log(title = "设备类型", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody DvMachineryType dvMachineryType)
+    {
+        return toResponse(dvMachineryTypeService.updateDvMachineryType(dvMachineryType));
+    }
+
+    /**
+     * 删除设备类型
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:machinerytype:remove')")
+    @Log(title = "设备类型", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{machineryTypeIds}")
+    public Response remove(@PathVariable Long[] machineryTypeIds)
+    {
+        for (Long typeId:machineryTypeIds
+             ) {
+            DvMachinery param = new DvMachinery();
+            param.setMachineryId(typeId);
+            List<DvMachinery> machinerys = dvMachineryService.selectDvMachineryList(param);
+            if(CollUtil.isNotEmpty(machinerys)){
+                throw new CustomException("设备类型下已配置了设备,不能删除!");
+            }
+        }
+
+        return toResponse(dvMachineryTypeService.deleteDvMachineryTypeByMachineryTypeIds(machineryTypeIds));
+    }
+}

+ 106 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/dv/DvRepairController.java

@@ -0,0 +1,106 @@
+package com.miaxis.mes.controller.dv;
+
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.dv.domain.DvRepair;
+import com.miaxis.mes.dv.service.IDvRepairService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 设备维修单Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-08-06
+ */
+@RestController
+@RequestMapping("/mes/dv/repair")
+public class DvRepairController extends BaseController
+{
+    @Autowired
+    private IDvRepairService dvRepairService;
+
+    /**
+     * 查询设备维修单列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:repair:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(DvRepair dvRepair)
+    {
+        startPage();
+        List<DvRepair> list = dvRepairService.selectDvRepairList(dvRepair);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出设备维修单列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:repair:export')")
+    @Log(title = "设备维修单", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, DvRepair dvRepair)
+    {
+        List<DvRepair> list = dvRepairService.selectDvRepairList(dvRepair);
+        ExcelUtil<DvRepair> util = new ExcelUtil<DvRepair>(DvRepair.class);
+        return util.exportExcel( list, "设备维修单数据");
+    }
+
+    /**
+     * 获取设备维修单详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:repair:query')")
+    @GetMapping(value = "/{repairId}")
+    public Response getInfo(@PathVariable("repairId") Long repairId)
+    {
+        return Response.success(dvRepairService.selectDvRepairByRepairId(repairId));
+    }
+
+    /**
+     * 新增设备维修单
+     */
+    @PreAuthorize("@ss.hasPermi('dv:repair:add')")
+    @Log(title = "设备维修单", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody DvRepair dvRepair)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(dvRepairService.checkCodeUnique(dvRepair))){
+            throw new CustomException("维修单编号已存!");
+        }
+        return toResponse(dvRepairService.insertDvRepair(dvRepair));
+    }
+
+    /**
+     * 修改设备维修单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:repair:edit')")
+    @Log(title = "设备维修单", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody DvRepair dvRepair)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(dvRepairService.checkCodeUnique(dvRepair))){
+            throw new CustomException("维修单编号已存!");
+        }
+        return toResponse(dvRepairService.updateDvRepair(dvRepair));
+    }
+
+    /**
+     * 删除设备维修单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:repair:remove')")
+    @Log(title = "设备维修单", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{repairIds}")
+    public Response remove(@PathVariable Long[] repairIds)
+    {
+        return toResponse(dvRepairService.deleteDvRepairByRepairIds(repairIds));
+    }
+}

+ 104 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/dv/DvRepairLineController.java

@@ -0,0 +1,104 @@
+package com.miaxis.mes.controller.dv;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.dv.domain.DvRepairLine;
+import com.miaxis.mes.dv.service.IDvRepairLineService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 设备维修单行Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-08-08
+ */
+@RestController
+@RequestMapping("/mes/dv/repairline")
+public class DvRepairLineController extends BaseController
+{
+    @Autowired
+    private IDvRepairLineService dvRepairLineService;
+
+    /**
+     * 查询设备维修单行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:repair:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(DvRepairLine dvRepairLine)
+    {
+        startPage();
+        List<DvRepairLine> list = dvRepairLineService.selectDvRepairLineList(dvRepairLine);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出设备维修单行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:repair:export')")
+    @Log(title = "设备维修单行", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, DvRepairLine dvRepairLine)
+    {
+        List<DvRepairLine> list = dvRepairLineService.selectDvRepairLineList(dvRepairLine);
+        ExcelUtil<DvRepairLine> util = new ExcelUtil<DvRepairLine>(DvRepairLine.class);
+        return util.exportExcel( list, "设备维修单行数据");
+    }
+
+    /**
+     * 获取设备维修单行详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:repair:query')")
+    @GetMapping(value = "/{lineId}")
+    public Response getInfo(@PathVariable("lineId") Long lineId)
+    {
+        return Response.success(dvRepairLineService.selectDvRepairLineByLineId(lineId));
+    }
+
+    /**
+     * 新增设备维修单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:repair:add')")
+    @Log(title = "设备维修单行", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody DvRepairLine dvRepairLine)
+    {
+        return toResponse(dvRepairLineService.insertDvRepairLine(dvRepairLine));
+    }
+
+    /**
+     * 修改设备维修单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:repair:edit')")
+    @Log(title = "设备维修单行", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody DvRepairLine dvRepairLine)
+    {
+        return toResponse(dvRepairLineService.updateDvRepairLine(dvRepairLine));
+    }
+
+    /**
+     * 删除设备维修单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:repair:remove')")
+    @Log(title = "设备维修单行", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{lineIds}")
+    public Response remove(@PathVariable Long[] lineIds)
+    {
+        return toResponse(dvRepairLineService.deleteDvRepairLineByLineIds(lineIds));
+    }
+}

+ 105 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/dv/DvSubjectController.java

@@ -0,0 +1,105 @@
+package com.miaxis.mes.controller.dv;
+
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.dv.domain.DvSubject;
+import com.miaxis.mes.dv.service.IDvSubjectService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 设备点检保养项目Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-06-16
+ */
+@RestController
+@RequestMapping("/mes/dv/dvsubject")
+public class DvSubjectController extends BaseController
+{
+    @Autowired
+    private IDvSubjectService dvSubjectService;
+
+    /**
+     * 查询设备点检保养项目列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(DvSubject dvSubject)
+    {
+        startPage();
+        List<DvSubject> list = dvSubjectService.selectDvSubjectList(dvSubject);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出设备点检保养项目列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:dvsubject:export')")
+    @Log(title = "设备点检保养项目", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, DvSubject dvSubject)
+    {
+        List<DvSubject> list = dvSubjectService.selectDvSubjectList(dvSubject);
+        ExcelUtil<DvSubject> util = new ExcelUtil<DvSubject>(DvSubject.class);
+        return util.exportExcel( list, "设备点检保养项目数据");
+    }
+
+    /**
+     * 获取设备点检保养项目详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:dvsubject:query')")
+    @GetMapping(value = "/{subjectId}")
+    public Response getInfo(@PathVariable("subjectId") Long subjectId)
+    {
+        return Response.success(dvSubjectService.selectDvSubjectBySubjectId(subjectId));
+    }
+
+    /**
+     * 新增设备点检保养项目
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:dvsubject:add')")
+    @Log(title = "设备点检保养项目", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody DvSubject dvSubject)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(dvSubjectService.checkSubjectCodeUnique(dvSubject))){
+            throw new CustomException("项目编码已存在!");
+        }
+        return toResponse(dvSubjectService.insertDvSubject(dvSubject));
+    }
+
+    /**
+     * 修改设备点检保养项目
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:dvsubject:edit')")
+    @Log(title = "设备点检保养项目", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody DvSubject dvSubject)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(dvSubjectService.checkSubjectCodeUnique(dvSubject))){
+            throw new CustomException("项目编码已存在!");
+        }
+        return toResponse(dvSubjectService.updateDvSubject(dvSubject));
+    }
+
+    /**
+     * 删除设备点检保养项目
+     */
+    @PreAuthorize("@ss.hasPermi('mes:dv:dvsubject:remove')")
+    @Log(title = "设备点检保养项目", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{subjectIds}")
+    public Response remove(@PathVariable Long[] subjectIds)
+    {
+        return toResponse(dvSubjectService.deleteDvSubjectBySubjectIds(subjectIds));
+    }
+}

+ 138 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/md/ItemTypeController.java

@@ -0,0 +1,138 @@
+package com.miaxis.mes.controller.md;
+
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.domain.entity.ItemType;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.md.service.IItemTypeService;
+import com.miaxis.system.strategy.AutoCodeUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Iterator;
+import java.util.List;
+
+@RestController
+@RequestMapping("/mes/md/itemtype")
+public class ItemTypeController extends BaseController {
+
+    @Autowired
+    private IItemTypeService iItemTypeService;
+    @Autowired
+    private AutoCodeUtil autoCodeUtil;
+
+    /**
+     * 查询分类列表
+     * @param itemType
+     * @return
+     */
+    @GetMapping("/list")
+    public Response list(ItemType itemType){
+        List<ItemType> list =iItemTypeService.selectItemTypeList(itemType);
+        return Response.success(list);
+    }
+
+    /**
+     * 查询部门列表(排除当前和父节点)
+     * @param itemTypeId
+     * @return
+     */
+    @GetMapping("/list/exclude/{itemTypeId}")
+    public Response excludeChild(@PathVariable(value = "itemTypeId",required = false)Long itemTypeId){
+        List<ItemType> list = iItemTypeService.selectItemTypeList(new ItemType());
+        Iterator<ItemType> it = list.iterator();
+        Long parentTypeId =0L;
+        while (it.hasNext()){
+            ItemType itemType = (ItemType) it.next();
+            if(itemType.getItemTypeId() == itemTypeId){
+                parentTypeId = itemType.getParentTypeId();
+                it.remove();
+            }
+
+            if(itemType.getItemTypeId() == parentTypeId){
+                it.remove();
+            }
+        }
+        return Response.success(list);
+    }
+
+    /**
+     * 查询部门详情
+     * @param itemTypeId
+     * @return
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:itemtype:query')")
+    @GetMapping(value = "/{itemTypeId}")
+    public Response getInfo(@PathVariable Long itemTypeId){
+        //权限校验?
+        return Response.success(iItemTypeService.selectItemTypeById(itemTypeId));
+    }
+
+    /**
+     * 获取树形结构数据
+     * @param itemType
+     * @return
+     */
+    @GetMapping("/treeselect")
+    public Response treeSelect(ItemType itemType){
+        List<ItemType> list = iItemTypeService.selectItemTypeList(itemType);
+        return Response.success(iItemTypeService.buildTreeSelect(list));
+    }
+
+
+    @PreAuthorize("@ss.hasPermi('mes:md:itemtype:add')")
+    @Log(title = "新增物料产品分类信息",businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@Validated @RequestBody ItemType itemType){
+
+        if(UserConstants.NOT_UNIQUE.equals(iItemTypeService.checkItemTypeCodeUnique(itemType))){
+            throw new CustomException("分类"+itemType.getItemTypeCode()+"编码已存在");
+        }
+        if(UserConstants.NOT_UNIQUE.equals(iItemTypeService.checkItemTypeNameUnique(itemType))){
+            throw new CustomException("分类"+itemType.getItemTypeCode()+"名称已存在");
+        }
+        if(itemType.getParentTypeId() ==null || itemType.getParentTypeId()==0){
+            itemType.setParentTypeId(0L);
+        }
+        //自动生成一个唯一编码
+        itemType.setItemTypeCode(autoCodeUtil.genSerialCode(UserConstants.ITEM_TYPE_CODE,null));
+        itemType.setCreateBy(getUsername());
+        return Response.success(iItemTypeService.insertItemType(itemType));
+    }
+
+    @PreAuthorize("@ss.hasPermi('mes:md:itemtype:update')")
+    @Log(title = "更新物料产品分类",businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response update(@Validated @RequestBody ItemType itemType){
+        if(UserConstants.NOT_UNIQUE.equals(iItemTypeService.checkItemTypeCodeUnique(itemType))){
+            throw new CustomException("分类"+itemType.getItemTypeCode()+"编码已存在");
+        }
+        if(UserConstants.NOT_UNIQUE.equals(iItemTypeService.checkItemTypeNameUnique(itemType))){
+            throw new CustomException("分类"+itemType.getItemTypeCode()+"名称已存在");
+        }
+        itemType.setUpdateBy(getUsername());
+        return Response.success(iItemTypeService.updateItemType(itemType));
+    }
+
+    @PreAuthorize("@ss.hasPermi('mes:md:itemtype:remove')")
+    @Log(title = "删除物料产品分类",businessType = BusinessTypeEnum.DELETE)
+    @DeleteMapping("/{itemTypeId}")
+    public Response del(@PathVariable Long itemTypeId){
+
+        if(iItemTypeService.checkHasChild(itemTypeId)){
+            throw new CustomException("分类下有子分类,请先删除子分类");
+        }
+
+        if(iItemTypeService.checkHasItem(itemTypeId)){
+            throw new CustomException("分类下有物料,请先删除物料");
+        }
+
+        //权限数据检查?
+        return Response.success(iItemTypeService.removeItemType(itemTypeId));
+    }
+
+}

+ 135 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdClientController.java

@@ -0,0 +1,135 @@
+package com.miaxis.mes.controller.md;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.mes.wm.utils.WmBarCodeUtil;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.md.domain.MdClient;
+import com.miaxis.mes.md.service.IMdClientService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 客户Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-06
+ */
+@RestController
+@RequestMapping("/mes/md/client")
+public class MdClientController extends BaseController
+{
+    @Autowired
+    private IMdClientService mdClientService;
+
+    @Autowired
+    private WmBarCodeUtil barCodeUtil;
+
+    /**
+     * 查询客户列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(MdClient mdClient)
+    {
+        startPage();
+        List<MdClient> list = mdClientService.selectMdClientList(mdClient);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出客户列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:client:export')")
+    @Log(title = "客户", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, MdClient mdClient)
+    {
+        List<MdClient> list = mdClientService.selectMdClientList(mdClient);
+        ExcelUtil<MdClient> util = new ExcelUtil<MdClient>(MdClient.class);
+        return util.exportExcel( list, "客户数据");
+    }
+
+    /**
+     * 获取客户详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:client:query')")
+    @GetMapping(value = "/{clientId}")
+    public Response getInfo(@PathVariable("clientId") Long clientId)
+    {
+        return Response.success(mdClientService.selectMdClientByClientId(clientId));
+    }
+
+    /**
+     * 新增客户
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:client:add')")
+    @Log(title = "客户", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody MdClient mdClient)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(mdClientService.checkClientCodeUnique(mdClient))){
+            throw new CustomException("客户编码已存在!");
+        }
+
+        if(UserConstants.NOT_UNIQUE.equals(mdClientService.checkClientNameUnique(mdClient))){
+            throw new CustomException("客户名称已存在!");
+        }
+
+        if(UserConstants.NOT_UNIQUE.equals(mdClientService.checkClientNickUnique(mdClient))){
+            throw new CustomException("客户简称已存在!");
+        }
+
+        mdClientService.insertMdClient(mdClient);
+        barCodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_CLIENT,mdClient.getClientId(),mdClient.getClientCode(),mdClient.getClientName());
+
+        return Response.success(mdClient.getClientId());
+    }
+
+    /**
+     * 修改客户
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:client:edit')")
+    @Log(title = "客户", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody MdClient mdClient)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(mdClientService.checkClientCodeUnique(mdClient))){
+            throw new CustomException("客户编码已存在!");
+        }
+
+        if(UserConstants.NOT_UNIQUE.equals(mdClientService.checkClientNameUnique(mdClient))){
+            throw new CustomException("客户名称已存在!");
+        }
+
+        if(UserConstants.NOT_UNIQUE.equals(mdClientService.checkClientNickUnique(mdClient))){
+            throw new CustomException("客户简称已存在!");
+        }
+        return toResponse(mdClientService.updateMdClient(mdClient));
+    }
+
+    /**
+     * 删除客户
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:client:remove')")
+    @Log(title = "客户", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{clientIds}")
+    public Response remove(@PathVariable Long[] clientIds)
+    {
+        return toResponse(mdClientService.deleteMdClientByClientIds(clientIds));
+    }
+}

+ 35 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdClientMobController.java

@@ -0,0 +1,35 @@
+package com.miaxis.mes.controller.md;
+
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.mes.md.domain.MdClient;
+import com.miaxis.mes.md.service.IMdClientService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@Api("客户信息")
+@RestController
+@RequestMapping("/mobile/md/client")
+public class MdClientMobController extends BaseController {
+    @Autowired
+    private IMdClientService mdClientService;
+
+    /**
+     * 查询客户列表
+     */
+    @ApiOperation("查询客户清单(分页)")
+    @GetMapping("/list")
+    public ResponsePageInfo list(MdClient mdClient)
+    {
+        startPage();
+        List<MdClient> list = mdClientService.selectMdClientList(mdClient);
+        return toResponsePageInfo(list);
+    }
+
+}

+ 126 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdItemController.java

@@ -0,0 +1,126 @@
+package com.miaxis.mes.controller.md;
+
+import com.miaxis.mes.aspect.BarcodeGen;
+import com.miaxis.mes.md.service.IMdItemService;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.domain.entity.ItemType;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.mes.md.domain.MdItem;
+import com.miaxis.mes.md.service.IItemTypeService;
+import com.miaxis.mes.wm.utils.WmBarCodeUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/mes/md/mditem")
+public class MdItemController extends BaseController {
+
+    @Autowired
+    private IMdItemService mdItemService;
+
+    @Autowired
+    private IItemTypeService iItemTypeService;
+
+    @Autowired
+    private WmBarCodeUtil barcodeUtil;
+
+    /**
+     * 列表查询
+     * @param mdItem
+     * @return
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(MdItem mdItem){
+        startPage();
+        List<MdItem> list = mdItemService.selectMdItemList(mdItem);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 主键查询
+     * @param itemId
+     * @return
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:mditem:query')")
+    @GetMapping(value = "/{itemId}")
+    public Response getInfo(@PathVariable Long itemId){
+        return Response.success(mdItemService.selectMdItemById(itemId));
+    }
+
+    /**
+     * 新增
+     * @param mdItem
+     * @return
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:mditem:add')")
+    @Log(title = "物料管理",businessType = BusinessTypeEnum.INSERT)
+    @BarcodeGen(barcodeType = UserConstants.BARCODE_TYPE_ITEM)
+    @PostMapping
+    public Response add(@Validated @RequestBody MdItem mdItem){
+        if(UserConstants.NOT_UNIQUE.equals(mdItemService.checkItemCodeUnique(mdItem))){
+            throw new CustomException("新增物料"+mdItem.getItemCode()+"失败,物料编码已存在");
+        }
+        if(UserConstants.NOT_UNIQUE.equals(mdItemService.checkItemNameUnique(mdItem))){
+            throw new CustomException("新增物料"+mdItem.getItemCode()+"失败,物料名称已存在");
+        }
+
+        ItemType type =iItemTypeService.selectItemTypeById(mdItem.getItemTypeId());
+        if(StringUtils.isNotNull(type)){
+            mdItem.setItemTypeCode(type.getItemTypeCode());
+            mdItem.setItemTypeName(type.getItemTypeName());
+            mdItem.setItemOrProduct(type.getItemOrProduct());
+        }
+        mdItem.setCreateBy(getUsername());
+        mdItemService.insertMdItem(mdItem);
+        barcodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_ITEM,mdItem.getItemId(),mdItem.getItemCode(), mdItem.getItemName());
+        return Response.success(mdItem.getItemId());
+    }
+
+    /**
+     * 更新
+     * @param mdItem
+     * @return
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:mditem:edit')")
+    @Log(title = "物料管理",businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@Validated @RequestBody MdItem mdItem){
+        if(UserConstants.NOT_UNIQUE.equals(mdItemService.checkItemCodeUnique(mdItem))){
+            throw new CustomException("新增物料"+mdItem.getItemCode()+"失败,物料编码已存在");
+        }
+        if(UserConstants.NOT_UNIQUE.equals(mdItemService.checkItemNameUnique(mdItem))){
+            throw new CustomException("新增物料"+mdItem.getItemCode()+"失败,物料名称已存在");
+        }
+        ItemType type =iItemTypeService.selectItemTypeById(mdItem.getItemTypeId());
+        if(StringUtils.isNotNull(type)){
+            mdItem.setItemTypeCode(type.getItemTypeCode());
+            mdItem.setItemTypeName(type.getItemTypeName());
+            mdItem.setItemOrProduct(type.getItemOrProduct());
+        }
+        if(StringUtils.isNotNull(mdItem.getSafeStockFlag())&& "N".equals(mdItem.getSafeStockFlag())){
+            mdItem.setMinStock(0D);
+            mdItem.setMaxStock(0D);
+        }
+
+        mdItem.setUpdateBy(getUsername());
+        return toResponse(mdItemService.updateMdItem(mdItem));
+    }
+
+    @PreAuthorize("@ss.hasPermi('mes:md:mditem:remove')")
+    @Log(title = "物料管理",businessType = BusinessTypeEnum.DELETE)
+    @DeleteMapping("/{itemIds}")
+    public Response remove(@PathVariable Long[] itemIds){
+        return toResponse(mdItemService.deleteByItemIds(itemIds));
+    }
+
+
+}

+ 36 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdItemMobController.java

@@ -0,0 +1,36 @@
+package com.miaxis.mes.controller.md;
+
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.mes.md.domain.MdItem;
+import com.miaxis.mes.md.service.IMdItemService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@Api("物料信息")
+@RestController
+@RequestMapping("/mobile/md/item")
+public class MdItemMobController extends BaseController {
+
+    @Autowired
+    private IMdItemService mdItemService;
+
+    /**
+     * 列表查询
+     * @param mdItem
+     * @return
+     */
+    @ApiOperation("查询物料清单(分页)")
+    @GetMapping("/list")
+    public ResponsePageInfo list(MdItem mdItem){
+        startPage();
+        List<MdItem> list = mdItemService.selectMdItemList(mdItem);
+        return toResponsePageInfo(list);
+    }
+}

+ 108 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdProductBomController.java

@@ -0,0 +1,108 @@
+package com.miaxis.mes.controller.md;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.miaxis.mes.md.service.IMdProductBomService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.md.domain.MdProductBom;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 产品BOM关系Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-09
+ */
+@RestController
+@RequestMapping("/mes/md/bom")
+public class MdProductBomController extends BaseController
+{
+    @Autowired
+    private IMdProductBomService mdProductBomService;
+
+    /**
+     * 查询产品BOM关系列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(MdProductBom mdProductBom)
+    {
+        startPage();
+        List<MdProductBom> list = mdProductBomService.selectMdProductBomList(mdProductBom);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出产品BOM关系列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:mditem:export')")
+    @Log(title = "产品BOM关系", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, MdProductBom mdProductBom)
+    {
+        List<MdProductBom> list = mdProductBomService.selectMdProductBomList(mdProductBom);
+        ExcelUtil<MdProductBom> util = new ExcelUtil<MdProductBom>(MdProductBom.class);
+        return util.exportExcel( list, "产品BOM关系数据");
+    }
+
+    /**
+     * 获取产品BOM关系详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:mditem:query')")
+    @GetMapping(value = "/{bomId}")
+    public Response getInfo(@PathVariable("bomId") Long bomId)
+    {
+        return Response.success(mdProductBomService.selectMdProductBomByBomId(bomId));
+    }
+
+    /**
+     * 新增产品BOM关系
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:mditem:add')")
+    @Log(title = "产品BOM关系", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody MdProductBom mdProductBom)
+    {
+        if(mdProductBom.getBomItemId() == mdProductBom.getItemId()){
+            throw new CustomException("产品不能作为自身的BOM物料!");
+        }
+
+        return toResponse(mdProductBomService.insertMdProductBom(mdProductBom));
+    }
+
+    /**
+     * 修改产品BOM关系
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:mditem:edit')")
+    @Log(title = "产品BOM关系", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody MdProductBom mdProductBom)
+    {
+        return toResponse(mdProductBomService.updateMdProductBom(mdProductBom));
+    }
+
+    /**
+     * 删除产品BOM关系
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:mditem:remove')")
+    @Log(title = "产品BOM关系", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{bomIds}")
+    public Response remove(@PathVariable Long[] bomIds)
+    {
+        return toResponse(mdProductBomService.deleteMdProductBomByBomIds(bomIds));
+    }
+}

+ 32 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdProductSOPMobController.java

@@ -0,0 +1,32 @@
+package com.miaxis.mes.controller.md;
+
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.mes.md.domain.MdProductSop;
+import com.miaxis.mes.md.service.IMdProductSopService;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/mobile/md/sop")
+public class MdProductSOPMobController extends BaseController {
+    @Autowired
+    private IMdProductSopService mdProductSopService;
+
+    /**
+     * 查询产品SOP列表
+     */
+    @ApiOperation("查询产品SOP信息")
+    @GetMapping("/list")
+    public Response list(MdProductSop mdProdutSop)
+    {
+        startPage();
+        List<MdProductSop> list = mdProductSopService.selectMdProductSopList(mdProdutSop);
+        return Response.success(list);
+    }
+}

+ 103 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdProductSipController.java

@@ -0,0 +1,103 @@
+package com.miaxis.mes.controller.md;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.md.domain.MdProductSip;
+import com.miaxis.mes.md.service.IMdProductSipService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 产品SIPController
+ * 
+ * @author yinjinlu
+ * @date 2023-10-31
+ */
+@RestController
+@RequestMapping("/mes/md/sip")
+public class MdProductSipController extends BaseController
+{
+    @Autowired
+    private IMdProductSipService mdProductSipService;
+
+    /**
+     * 查询产品SIP列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(MdProductSip mdProductSip)
+    {
+        startPage();
+        List<MdProductSip> list = mdProductSipService.selectMdProductSipList(mdProductSip);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出产品SIP列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:mditem:export')")
+    @Log(title = "产品SIP", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, MdProductSip mdProductSip)
+    {
+        List<MdProductSip> list = mdProductSipService.selectMdProductSipList(mdProductSip);
+        ExcelUtil<MdProductSip> util = new ExcelUtil<MdProductSip>(MdProductSip.class);
+        return util.exportExcel( list, "产品SIP数据");
+    }
+
+    /**
+     * 获取产品SIP详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:mditem:query')")
+    @GetMapping(value = "/{sipId}")
+    public Response getInfo(@PathVariable("sipId") Long sipId)
+    {
+        return Response.success(mdProductSipService.selectMdProductSipBySipId(sipId));
+    }
+
+    /**
+     * 新增产品SIP
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:mditem:add')")
+    @Log(title = "产品SIP", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody MdProductSip mdProductSip)
+    {
+        return toResponse(mdProductSipService.insertMdProductSip(mdProductSip));
+    }
+
+    /**
+     * 修改产品SIP
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:mditem:edit')")
+    @Log(title = "产品SIP", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody MdProductSip mdProductSip)
+    {
+        return toResponse(mdProductSipService.updateMdProductSip(mdProductSip));
+    }
+
+    /**
+     * 删除产品SIP
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:mditem:remove')")
+    @Log(title = "产品SIP", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{sipIds}")
+    public Response remove(@PathVariable Long[] sipIds)
+    {
+        return toResponse(mdProductSipService.deleteMdProductSipBySipIds(sipIds));
+    }
+}

+ 103 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdProductSopController.java

@@ -0,0 +1,103 @@
+package com.miaxis.mes.controller.md;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.md.domain.MdProductSop;
+import com.miaxis.mes.md.service.IMdProductSopService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 产品SOPController
+ * 
+ * @author yinjinlu
+ * @date 2022-07-26
+ */
+@RestController
+@RequestMapping("/mes/md/sop")
+public class MdProductSopController extends BaseController
+{
+    @Autowired
+    private IMdProductSopService mdProductSopService;
+
+    /**
+     * 查询产品SOP列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(MdProductSop mdProdutSop)
+    {
+        startPage();
+        List<MdProductSop> list = mdProductSopService.selectMdProductSopList(mdProdutSop);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出产品SOP列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:mditem:export')")
+    @Log(title = "产品SOP", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, MdProductSop mdProdutSop)
+    {
+        List<MdProductSop> list = mdProductSopService.selectMdProductSopList(mdProdutSop);
+        ExcelUtil<MdProductSop> util = new ExcelUtil<MdProductSop>(MdProductSop.class);
+        return util.exportExcel( list, "产品SOP数据");
+    }
+
+    /**
+     * 获取产品SOP详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:mditem:query')")
+    @GetMapping(value = "/{sopId}")
+    public Response getInfo(@PathVariable("sopId") Long sopId)
+    {
+        return Response.success(mdProductSopService.selectMdProductSopBySopId(sopId));
+    }
+
+    /**
+     * 新增产品SOP
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:mditem:add')")
+    @Log(title = "产品SOP", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody MdProductSop mdProdutSop)
+    {
+        return toResponse(mdProductSopService.insertMdProductSop(mdProdutSop));
+    }
+
+    /**
+     * 修改产品SOP
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:mditem:edit')")
+    @Log(title = "产品SOP", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody MdProductSop mdProdutSop)
+    {
+        return toResponse(mdProductSopService.updateMdProductSop(mdProdutSop));
+    }
+
+    /**
+     * 删除产品SOP
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:mditem:remove')")
+    @Log(title = "产品SOP", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{sopIds}")
+    public Response remove(@PathVariable Long[] sopIds)
+    {
+        return toResponse(mdProductSopService.deleteMdProductSopBySopIds(sopIds));
+    }
+}

+ 113 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdUnitMeasureController.java

@@ -0,0 +1,113 @@
+package com.miaxis.mes.controller.md;
+
+import com.miaxis.mes.md.service.IMdUnitMeasureService;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.md.domain.MdUnitMeasure;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 单位Controller
+ * 
+ * @author ruoyi
+ * @date 2022-04-27
+ */
+@RestController
+@RequestMapping("/mes/md/unitmeasure")
+public class MdUnitMeasureController extends BaseController
+{
+    @Autowired
+    private IMdUnitMeasureService mdUnitMeasureService;
+
+    /**
+     * 查询单位列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(MdUnitMeasure mdUnitMeasure)
+    {
+        startPage();
+        List<MdUnitMeasure> list = mdUnitMeasureService.selectMdUnitMeasureList(mdUnitMeasure);
+        return toResponsePageInfo(list);
+    }
+
+    @GetMapping("/listprimary")
+    public Response listPrimary(){
+        MdUnitMeasure mdUnitMeasure = new MdUnitMeasure();
+        mdUnitMeasure.setPrimaryFlag("Y");
+        List<MdUnitMeasure> list = mdUnitMeasureService.selectMdUnitMeasureList(mdUnitMeasure);
+        return Response.success(list);
+    }
+
+    @GetMapping("/selectall")
+    public Response selectAll(){
+        MdUnitMeasure mdUnitMeasure = new MdUnitMeasure();
+        mdUnitMeasure.setEnableFlag("Y");
+        List<MdUnitMeasure> list = mdUnitMeasureService.selectMdUnitMeasureList(mdUnitMeasure);
+        return Response.success(list);
+    }
+
+    /**
+     * 导出单位列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:unitmeasure:export')")
+    @Log(title = "单位", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, MdUnitMeasure mdUnitMeasure)
+    {
+        List<MdUnitMeasure> list = mdUnitMeasureService.selectMdUnitMeasureList(mdUnitMeasure);
+        ExcelUtil<MdUnitMeasure> util = new ExcelUtil<MdUnitMeasure>(MdUnitMeasure.class);
+        return util.exportExcel( list, "单位数据");
+    }
+
+    /**
+     * 获取单位详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:unitmeasure:query')")
+    @GetMapping(value = "/{measureId}")
+    public Response getInfo(@PathVariable("measureId") Long measureId)
+    {
+        return Response.success(mdUnitMeasureService.selectMdUnitMeasureByMeasureId(measureId));
+    }
+
+    /**
+     * 新增单位
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:unitmeasure:add')")
+    @Log(title = "单位", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody MdUnitMeasure mdUnitMeasure)
+    {
+        return toResponse(mdUnitMeasureService.insertMdUnitMeasure(mdUnitMeasure));
+    }
+
+    /**
+     * 修改单位
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:unitmeasure:edit')")
+    @Log(title = "单位", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody MdUnitMeasure mdUnitMeasure)
+    {
+        return toResponse(mdUnitMeasureService.updateMdUnitMeasure(mdUnitMeasure));
+    }
+
+    /**
+     * 删除单位
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:unitmeasure:remove')")
+    @Log(title = "单位", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{measureIds}")
+    public Response remove(@PathVariable Long[] measureIds)
+    {
+        return toResponse(mdUnitMeasureService.deleteMdUnitMeasureByMeasureIds(measureIds));
+    }
+}

+ 131 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdVendorController.java

@@ -0,0 +1,131 @@
+package com.miaxis.mes.controller.md;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.mes.wm.utils.WmBarCodeUtil;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.md.domain.MdVendor;
+import com.miaxis.mes.md.service.IMdVendorService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 供应商Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-06
+ */
+@RestController
+@RequestMapping("/mes/md/vendor")
+public class MdVendorController extends BaseController
+{
+    @Autowired
+    private IMdVendorService mdVendorService;
+
+    @Autowired
+    private WmBarCodeUtil barCodeUtil;
+
+    /**
+     * 查询供应商列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(MdVendor mdVendor)
+    {
+        startPage();
+        List<MdVendor> list = mdVendorService.selectMdVendorList(mdVendor);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出供应商列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:vendor:export')")
+    @Log(title = "供应商", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, MdVendor mdVendor)
+    {
+        List<MdVendor> list = mdVendorService.selectMdVendorList(mdVendor);
+        ExcelUtil<MdVendor> util = new ExcelUtil<MdVendor>(MdVendor.class);
+        return util.exportExcel( list, "供应商数据");
+    }
+
+    /**
+     * 获取供应商详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:vendor:query')")
+    @GetMapping(value = "/{vendorId}")
+    public Response getInfo(@PathVariable("vendorId") Long vendorId)
+    {
+        return Response.success(mdVendorService.selectMdVendorByVendorId(vendorId));
+    }
+
+    /**
+     * 新增供应商
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:vendor:add')")
+    @Log(title = "供应商", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody MdVendor mdVendor)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(mdVendorService.checkVendorCodeUnique(mdVendor))){
+            throw new CustomException("供应商编码已存在!");
+        }
+        if(UserConstants.NOT_UNIQUE.equals(mdVendorService.checkVendorNameUnique(mdVendor))){
+            throw new CustomException("供应商名称已存在!");
+        }
+        if(UserConstants.NOT_UNIQUE.equals(mdVendorService.checkVendorNickUnique(mdVendor))){
+            throw new CustomException("供应商简称已存在!");
+        }
+
+        mdVendorService.insertMdVendor(mdVendor);
+        barCodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_VENDOR,mdVendor.getVendorId(),mdVendor.getVendorCode(),mdVendor.getVendorName());
+
+        return Response.success(mdVendor.getVendorId());
+    }
+
+    /**
+     * 修改供应商
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:vendor:edit')")
+    @Log(title = "供应商", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody MdVendor mdVendor)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(mdVendorService.checkVendorCodeUnique(mdVendor))){
+            throw new CustomException("供应商编码已存在!");
+        }
+        if(UserConstants.NOT_UNIQUE.equals(mdVendorService.checkVendorNameUnique(mdVendor))){
+            throw new CustomException("供应商名称已存在!");
+        }
+        if(UserConstants.NOT_UNIQUE.equals(mdVendorService.checkVendorNickUnique(mdVendor))){
+            throw new CustomException("供应商简称已存在!");
+        }
+        return toResponse(mdVendorService.updateMdVendor(mdVendor));
+    }
+
+    /**
+     * 删除供应商
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:vendor:remove')")
+    @Log(title = "供应商", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{vendorIds}")
+    public Response remove(@PathVariable Long[] vendorIds)
+    {
+        return toResponse(mdVendorService.deleteMdVendorByVendorIds(vendorIds));
+    }
+}

+ 35 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdVendorMobController.java

@@ -0,0 +1,35 @@
+package com.miaxis.mes.controller.md;
+
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.mes.md.domain.MdVendor;
+import com.miaxis.mes.md.service.IMdVendorService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@Api("供应商信息")
+@RestController
+@RequestMapping("/mobile/md/vendor")
+public class MdVendorMobController extends BaseController {
+
+    @Autowired
+    private IMdVendorService mdVendorService;
+
+    /**
+     * 查询供应商列表
+     */
+    @ApiOperation("查询供应商清单(分页)")
+    @GetMapping("/list")
+    public ResponsePageInfo list(MdVendor mdVendor)
+    {
+        startPage();
+        List<MdVendor> list = mdVendorService.selectMdVendorList(mdVendor);
+        return toResponsePageInfo(list);
+    }
+}

+ 129 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdWorkshopController.java

@@ -0,0 +1,129 @@
+package com.miaxis.mes.controller.md;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.miaxis.common.constant.UserConstants;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.md.domain.MdWorkshop;
+import com.miaxis.mes.md.service.IMdWorkshopService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 车间Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-07
+ */
+@RestController
+@RequestMapping("/mes/md/workshop")
+public class MdWorkshopController extends BaseController
+{
+    @Autowired
+    private IMdWorkshopService mdWorkshopService;
+
+    /**
+     * 查询车间列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(MdWorkshop mdWorkshop)
+    {
+        startPage();
+        List<MdWorkshop> list = mdWorkshopService.selectMdWorkshopList(mdWorkshop);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 获取所有可用车间
+     * @return
+     */
+    @GetMapping("/listAll")
+    public Response listAll(){
+        MdWorkshop mdWorkshop = new MdWorkshop();
+        mdWorkshop.setEnableFlag("Y");
+        List<MdWorkshop> list = mdWorkshopService.selectMdWorkshopList(mdWorkshop);
+        return Response.success(list);
+    }
+
+    /**
+     * 导出车间列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:workshop:export')")
+    @Log(title = "车间", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, MdWorkshop mdWorkshop)
+    {
+        List<MdWorkshop> list = mdWorkshopService.selectMdWorkshopList(mdWorkshop);
+        ExcelUtil<MdWorkshop> util = new ExcelUtil<MdWorkshop>(MdWorkshop.class);
+        return util.exportExcel( list, "车间数据");
+    }
+
+    /**
+     * 获取车间详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:workshop:query')")
+    @GetMapping(value = "/{workshopId}")
+    public Response getInfo(@PathVariable("workshopId") Long workshopId)
+    {
+        return Response.success(mdWorkshopService.selectMdWorkshopByWorkshopId(workshopId));
+    }
+
+    /**
+     * 新增车间
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:workshop:add')")
+    @Log(title = "车间", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody MdWorkshop mdWorkshop)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(mdWorkshopService.checkWorkshopCodeUnique(mdWorkshop))){
+            throw new CustomException("车间编码已存在!");
+        }
+        if(UserConstants.NOT_UNIQUE.equals(mdWorkshopService.checkWorkshopNameUnique(mdWorkshop))){
+            throw new CustomException("车间名称已存在!");
+        }
+        return toResponse(mdWorkshopService.insertMdWorkshop(mdWorkshop));
+    }
+
+    /**
+     * 修改车间
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:workshop:edit')")
+    @Log(title = "车间", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody MdWorkshop mdWorkshop)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(mdWorkshopService.checkWorkshopCodeUnique(mdWorkshop))){
+            throw new CustomException("车间编码已存在!");
+        }
+        if(UserConstants.NOT_UNIQUE.equals(mdWorkshopService.checkWorkshopNameUnique(mdWorkshop))){
+            throw new CustomException("车间名称已存在!");
+        }
+        return toResponse(mdWorkshopService.updateMdWorkshop(mdWorkshop));
+    }
+
+    /**
+     * 删除车间
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:workshop:remove')")
+    @Log(title = "车间", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{workshopIds}")
+    public Response remove(@PathVariable Long[] workshopIds)
+    {
+        return toResponse(mdWorkshopService.deleteMdWorkshopByWorkshopIds(workshopIds));
+    }
+}

+ 235 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdWorkstationController.java

@@ -0,0 +1,235 @@
+package com.miaxis.mes.controller.md;
+
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.md.domain.MdWorkshop;
+import com.miaxis.mes.md.domain.MdWorkstation;
+import com.miaxis.mes.md.service.*;
+import com.miaxis.mes.pro.domain.ProProcess;
+import com.miaxis.mes.pro.service.IProProcessService;
+import com.miaxis.mes.wm.domain.WmStorageArea;
+import com.miaxis.mes.wm.domain.WmStorageLocation;
+import com.miaxis.mes.wm.domain.WmWarehouse;
+import com.miaxis.mes.wm.service.IWmStorageAreaService;
+import com.miaxis.mes.wm.service.IWmStorageLocationService;
+import com.miaxis.mes.wm.service.IWmWarehouseService;
+import com.miaxis.mes.wm.utils.WmBarCodeUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 工作站Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-10
+ */
+@RestController
+@RequestMapping("/mes/md/workstation")
+public class MdWorkstationController extends BaseController
+{
+    @Autowired
+    private IMdWorkstationService mdWorkstationService;
+
+    @Autowired
+    private IMdWorkstationMachineService mdWorkstationMachineService;
+
+    @Autowired
+    private IMdWorkstationToolService mdWorkstationToolService;
+
+    @Autowired
+    private IMdWorkstationWorkerService mdWorkstationWorkerService;
+
+    @Autowired
+    private IProProcessService proProcessService;
+
+    @Autowired
+    private IMdWorkshopService mdWorkshopService;
+
+    @Autowired
+    private IWmWarehouseService wmWarehouseService;
+
+    @Autowired
+    private IWmStorageLocationService wmStorageLocationService;
+
+    @Autowired
+    private IWmStorageAreaService wmStorageAreaService;
+
+    @Autowired
+    private WmBarCodeUtil barCodeUtil;
+
+    /**
+     * 查询工作站列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(MdWorkstation mdWorkstation)
+    {
+        startPage();
+        List<MdWorkstation> list = mdWorkstationService.selectMdWorkstationList(mdWorkstation);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出工作站列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:workstation:export')")
+    @Log(title = "工作站", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, MdWorkstation mdWorkstation)
+    {
+        List<MdWorkstation> list = mdWorkstationService.selectMdWorkstationList(mdWorkstation);
+        ExcelUtil<MdWorkstation> util = new ExcelUtil<MdWorkstation>(MdWorkstation.class);
+        return util.exportExcel( list, "工作站数据");
+    }
+
+    /**
+     * 获取工作站详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:workstation:query')")
+    @GetMapping(value = "/{workstationId}")
+    public Response getInfo(@PathVariable("workstationId") Long workstationId)
+    {
+        return Response.success(mdWorkstationService.selectMdWorkstationByWorkstationId(workstationId));
+    }
+
+    /**
+     * 新增工作站
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:workstation:add')")
+    @Log(title = "工作站", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody MdWorkstation mdWorkstation)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(mdWorkstationService.checkWorkStationCodeUnique(mdWorkstation))){
+            throw new CustomException("工作站编码已存在!");
+        }
+        if(UserConstants.NOT_UNIQUE.equals(mdWorkstationService.checkWorkStationNameUnique(mdWorkstation))){
+            throw new CustomException("工作站名称已存在!");
+        }
+        ProProcess process = proProcessService.selectProProcessByProcessId(mdWorkstation.getProcessId());
+        mdWorkstation.setProcessCode(process.getProcessCode());
+        mdWorkstation.setProcessName(process.getProcessName());
+
+        MdWorkshop workshop = mdWorkshopService.selectMdWorkshopByWorkshopId(mdWorkstation.getWorkshopId());
+        mdWorkstation.setWorkshopCode(workshop.getWorkshopCode());
+        mdWorkstation.setWorkshopName(workshop.getWorkshopName());
+
+        //线边库的设置
+        WmWarehouse warehouse = null;
+        WmStorageLocation location = null;
+        WmStorageArea area = null;
+        if(StringUtils.isNotNull(mdWorkstation.getWarehouseId())){
+            //如果有指定线边库
+            warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(mdWorkstation.getWarehouseId());
+            location = wmStorageLocationService.selectWmStorageLocationByLocationId(mdWorkstation.getLocationId());
+            area = wmStorageAreaService.selectWmStorageAreaByAreaId(mdWorkstation.getAreaId());
+        }else {
+            //设置默认的线边库
+            warehouse = wmWarehouseService.selectWmWarehouseByWarehouseCode(UserConstants.VIRTUAL_WH);
+            if(StringUtils.isNull(warehouse)){
+                //如果没有找到默认的线边库,则进行一次初始化
+                warehouse = wmWarehouseService.initVirtualWarehouse();
+            }
+            location = wmStorageLocationService.selectWmStorageLocationByLocationCode(UserConstants.VIRTUAL_WS);
+            area = wmStorageAreaService.selectWmStorageAreaByAreaCode(UserConstants.VIRTUAL_WA);
+        }
+        mdWorkstation.setWarehouseId(warehouse.getWarehouseId());
+        mdWorkstation.setWarehouseCode(warehouse.getWarehouseCode());
+        mdWorkstation.setWarehouseName(warehouse.getWarehouseName());
+        mdWorkstation.setLocationId(location.getLocationId());
+        mdWorkstation.setLocationCode(location.getLocationCode());
+        mdWorkstation.setLocationName(location.getLocationName());
+        mdWorkstation.setAreaId(area.getAreaId());
+        mdWorkstation.setAreaCode(area.getAreaCode());
+        mdWorkstation.setAreaName(area.getAreaName());
+        mdWorkstationService.insertMdWorkstation(mdWorkstation);
+        barCodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_WORKSTATION,mdWorkstation.getWorkstationId(), mdWorkstation.getWorkstationCode(),mdWorkstation.getWorkstationName());
+        return Response.success(mdWorkstation.getWorkstationId());
+    }
+
+    /**
+     * 修改工作站
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:workstation:edit')")
+    @Log(title = "工作站", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody MdWorkstation mdWorkstation)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(mdWorkstationService.checkWorkStationCodeUnique(mdWorkstation))){
+            throw new CustomException("工作站编码已存在!");
+        }
+        if(UserConstants.NOT_UNIQUE.equals(mdWorkstationService.checkWorkStationNameUnique(mdWorkstation))){
+            throw new CustomException("工作站名称已存在!");
+        }
+        ProProcess process = proProcessService.selectProProcessByProcessId(mdWorkstation.getProcessId());
+        if(!StringUtils.isNotNull(process)){
+            throw new CustomException("工序不存在!");
+        }
+        mdWorkstation.setProcessCode(process.getProcessCode());
+        mdWorkstation.setProcessName(process.getProcessName());
+
+        MdWorkshop workshop = mdWorkshopService.selectMdWorkshopByWorkshopId(mdWorkstation.getWorkshopId());
+        if(!StringUtils.isNotNull(workshop)){
+            throw new CustomException("车间不存在!");
+        }
+        mdWorkstation.setWorkshopCode(workshop.getWorkshopCode());
+        mdWorkstation.setWorkshopName(workshop.getWorkshopName());
+
+        //线边库的设置
+        WmWarehouse warehouse = null;
+        WmStorageLocation location = null;
+        WmStorageArea area = null;
+        if(StringUtils.isNotNull(mdWorkstation.getWarehouseId())){
+            //如果有指定线边库
+            warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(mdWorkstation.getWarehouseId());
+            location = wmStorageLocationService.selectWmStorageLocationByLocationId(mdWorkstation.getLocationId());
+            area = wmStorageAreaService.selectWmStorageAreaByAreaId(mdWorkstation.getAreaId());
+        }else {
+            //设置默认的线边库
+            warehouse = wmWarehouseService.selectWmWarehouseByWarehouseCode(UserConstants.VIRTUAL_WH);
+            if(StringUtils.isNull(warehouse)){
+                //如果没有找到默认的线边库,则进行一次初始化
+                warehouse = wmWarehouseService.initVirtualWarehouse();
+            }
+            location = wmStorageLocationService.selectWmStorageLocationByLocationCode(UserConstants.VIRTUAL_WS);
+            area = wmStorageAreaService.selectWmStorageAreaByAreaCode(UserConstants.VIRTUAL_WA);
+        }
+        mdWorkstation.setWarehouseCode(warehouse.getWarehouseCode());
+        mdWorkstation.setWarehouseName(warehouse.getWarehouseName());
+        mdWorkstation.setLocationCode(location.getLocationCode());
+        mdWorkstation.setLocationName(location.getLocationName());
+        mdWorkstation.setAreaCode(area.getAreaCode());
+        mdWorkstation.setAreaName(area.getAreaName());
+
+        return toResponse(mdWorkstationService.updateMdWorkstation(mdWorkstation));
+    }
+
+    /**
+     * 删除工作站
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:workstation:remove')")
+    @Log(title = "工作站", businessType = BusinessTypeEnum.DELETE)
+    @Transactional
+	@DeleteMapping("/{workstationIds}")
+    public Response remove(@PathVariable Long[] workstationIds)
+    {
+        for (Long workstationId: workstationIds
+             ) {
+            mdWorkstationMachineService.deleteByWorkstationId(workstationId);
+            mdWorkstationToolService.deleteByWorkstationId(workstationId);
+            mdWorkstationWorkerService.deleteByWorkstationId(workstationId);
+        }
+        return toResponse(mdWorkstationService.deleteMdWorkstationByWorkstationIds(workstationIds));
+    }
+}

+ 116 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdWorkstationMachineController.java

@@ -0,0 +1,116 @@
+package com.miaxis.mes.controller.md;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.mes.md.domain.MdWorkstation;
+import com.miaxis.mes.md.service.IMdWorkstationService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.md.domain.MdWorkstationMachine;
+import com.miaxis.mes.md.service.IMdWorkstationMachineService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 设备资源Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-12
+ */
+@RestController
+@RequestMapping("/mes/md/workstationmachine")
+public class MdWorkstationMachineController extends BaseController
+{
+    @Autowired
+    private IMdWorkstationMachineService mdWorkstationMachineService;
+
+    @Autowired
+    private IMdWorkstationService mdWorkstationService;
+
+    /**
+     * 查询设备资源列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(MdWorkstationMachine mdWorkstationMachine)
+    {
+        startPage();
+        List<MdWorkstationMachine> list = mdWorkstationMachineService.selectMdWorkstationMachineList(mdWorkstationMachine);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出设备资源列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:workstation:export')")
+    @Log(title = "设备资源", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, MdWorkstationMachine mdWorkstationMachine)
+    {
+        List<MdWorkstationMachine> list = mdWorkstationMachineService.selectMdWorkstationMachineList(mdWorkstationMachine);
+        ExcelUtil<MdWorkstationMachine> util = new ExcelUtil<MdWorkstationMachine>(MdWorkstationMachine.class);
+        return util.exportExcel( list, "设备资源数据");
+    }
+
+    /**
+     * 获取设备资源详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:workstation:query')")
+    @GetMapping(value = "/{recordId}")
+    public Response getInfo(@PathVariable("recordId") Long recordId)
+    {
+        return Response.success(mdWorkstationMachineService.selectMdWorkstationMachineByRecordId(recordId));
+    }
+
+    /**
+     * 新增设备资源
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:workstation:add')")
+    @Log(title = "设备资源", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody MdWorkstationMachine mdWorkstationMachine)
+    {
+        MdWorkstationMachine machine = mdWorkstationMachineService.checkMachineryExists(mdWorkstationMachine);
+        if(StringUtils.isNotNull(machine)){
+            MdWorkstation workstation = mdWorkstationService.selectMdWorkstationByWorkstationId(machine.getWorkstationId());
+            throw new CustomException("设备已分配至工作站:"+workstation.getWorkstationName());
+        }
+        return toResponse(mdWorkstationMachineService.insertMdWorkstationMachine(mdWorkstationMachine));
+    }
+
+    /**
+     * 修改设备资源
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:workstation:edit')")
+    @Log(title = "设备资源", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody MdWorkstationMachine mdWorkstationMachine)
+    {
+        return toResponse(mdWorkstationMachineService.updateMdWorkstationMachine(mdWorkstationMachine));
+    }
+
+    /**
+     * 删除设备资源
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:workstation:remove')")
+    @Log(title = "设备资源", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{recordIds}")
+    public Response remove(@PathVariable Long[] recordIds)
+    {
+        return toResponse(mdWorkstationMachineService.deleteMdWorkstationMachineByRecordIds(recordIds));
+    }
+}

+ 110 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdWorkstationMobController.java

@@ -0,0 +1,110 @@
+package com.miaxis.mes.controller.md;
+
+import cn.hutool.core.collection.CollectionUtil;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.domain.entity.SysUser;
+import com.miaxis.common.core.domain.model.LoginUser;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.SecurityUtils;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.mes.md.domain.MdWorkstation;
+import com.miaxis.mes.md.service.IMdWorkstationService;
+import com.miaxis.mes.pro.domain.ProUserWorkstation;
+import com.miaxis.mes.pro.domain.ProWorkrecord;
+import com.miaxis.mes.pro.service.IProUserWorkstationService;
+import com.miaxis.mes.pro.service.IProWorkrecordService;
+import com.miaxis.system.service.ISysUserService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+@Api
+@RestController
+@RequestMapping("/mobile/md/workstation")
+public class MdWorkstationMobController extends BaseController {
+//    @Autowired
+//    private TokenService tokenService;
+
+    @Autowired
+    private ISysUserService sysUserService;
+
+    @Autowired
+    private IMdWorkstationService mdWorkstationService;
+
+    @Autowired
+    private IProWorkrecordService workrecordService;
+
+    @Autowired
+    private IProUserWorkstationService userWorkstationService;
+
+    @ApiOperation("工作站查询接口")
+    @GetMapping("/getWorkstationList")
+    public Response getWorkstationList(MdWorkstation mdWorkstation){
+        List<MdWorkstation> list = mdWorkstationService.selectMdWorkstationList(mdWorkstation);
+        return Response.success(list);
+    }
+
+    @ApiOperation("获取当前用户绑定的工作站")
+    @GetMapping("/getMyWorkstation")
+    public Response getBindWorkstation(HttpServletRequest request){
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        SysUser user = sysUserService.selectUserById(loginUser.getUser().getUserId());
+        ProUserWorkstation param = new ProUserWorkstation();
+        param.setUserId(user.getUserId());
+        List<ProUserWorkstation> uw = userWorkstationService.selectProUserWorkstationList(param);
+        if(!CollectionUtil.isEmpty(uw)){
+            return Response.success(uw.get(0));
+        }
+        return Response.success();
+    }
+
+    @ApiOperation("上工/下工记录")
+    @PutMapping()
+    @Transactional
+    public Response bindWorkstation(@RequestBody ProWorkrecord workrecord){
+        MdWorkstation param = new MdWorkstation();
+        param.setWorkstationCode(workrecord.getWorkstationCode());
+        List<MdWorkstation> workstations = mdWorkstationService.selectMdWorkstationList(param);
+        MdWorkstation workstation = null;
+        if(!CollectionUtil.isEmpty(workstations)){
+            workstation = workstations.get(0);
+        }
+
+        if(!StringUtils.isNotNull(workstation)){
+            throw new CustomException("未能找到对应的工作站");
+        }
+
+        SysUser user = sysUserService.selectUserById(workrecord.getUserId());
+        workrecord.setUserName(user.getUserName());
+        workrecord.setWorkstationId(workstation.getWorkstationId());
+        workrecord.setWorkstationName(workstation.getWorkstationName());
+        workrecordService.insertProWorkrecord(workrecord);
+
+        ProUserWorkstation uw = new ProUserWorkstation();
+        uw.setUserId(workrecord.getUserId());
+        uw.setUserName(workrecord.getUserName());
+        uw.setNickName(workrecord.getNickName());
+        uw.setWorkstationId(workstation.getWorkstationId());
+        uw.setWorkstationCode(workstation.getWorkstationCode());
+        uw.setWorkstationName(workstation.getWorkstationName());
+
+        if(UserConstants.YES.equals(workrecord.getOperationFlag())){
+            //如果是绑定
+            userWorkstationService.deleteByUserName(workrecord.getUserName());
+
+            userWorkstationService.insertProUserWorkstation(uw);
+        }else{
+            userWorkstationService.deleteByUserName(workrecord.getUserName());
+        }
+
+        return Response.success();
+    }
+
+}

+ 122 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdWorkstationToolController.java

@@ -0,0 +1,122 @@
+package com.miaxis.mes.controller.md;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.mes.tm.domain.TmToolType;
+import com.miaxis.mes.tm.service.ITmToolTypeService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.md.domain.MdWorkstationTool;
+import com.miaxis.mes.md.service.IMdWorkstationToolService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 工装夹具资源Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-12
+ */
+@RestController
+@RequestMapping("/mes/md/workstationtool")
+public class MdWorkstationToolController extends BaseController
+{
+    @Autowired
+    private IMdWorkstationToolService mdWorkstationToolService;
+
+    @Autowired
+    private ITmToolTypeService toolTypeService;
+
+    /**
+     * 查询工装夹具资源列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(MdWorkstationTool mdWorkstationTool)
+    {
+        startPage();
+        List<MdWorkstationTool> list = mdWorkstationToolService.selectMdWorkstationToolList(mdWorkstationTool);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出工装夹具资源列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:workstation:export')")
+    @Log(title = "工装夹具资源", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, MdWorkstationTool mdWorkstationTool)
+    {
+        List<MdWorkstationTool> list = mdWorkstationToolService.selectMdWorkstationToolList(mdWorkstationTool);
+        ExcelUtil<MdWorkstationTool> util = new ExcelUtil<MdWorkstationTool>(MdWorkstationTool.class);
+        return util.exportExcel( list, "工装夹具资源数据");
+    }
+
+    /**
+     * 获取工装夹具资源详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:workstation:query')")
+    @GetMapping(value = "/{recordId}")
+    public Response getInfo(@PathVariable("recordId") Long recordId)
+    {
+        return Response.success(mdWorkstationToolService.selectMdWorkstationToolByRecordId(recordId));
+    }
+
+    /**
+     * 新增工装夹具资源
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:workstation:add')")
+    @Log(title = "工装夹具资源", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody MdWorkstationTool mdWorkstationTool)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(mdWorkstationToolService.checkToolTypeExists(mdWorkstationTool))){
+            throw new CustomException("此工装夹具类型已添加!");
+        }
+        TmToolType type = toolTypeService.selectTmToolTypeByToolTypeId(mdWorkstationTool.getToolTypeId());
+        mdWorkstationTool.setToolTypeCode(type.getToolTypeCode());
+        mdWorkstationTool.setToolTypeName(type.getToolTypeName());
+        return toResponse(mdWorkstationToolService.insertMdWorkstationTool(mdWorkstationTool));
+    }
+
+    /**
+     * 修改工装夹具资源
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:workstation:edit')")
+    @Log(title = "工装夹具资源", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody MdWorkstationTool mdWorkstationTool)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(mdWorkstationToolService.checkToolTypeExists(mdWorkstationTool))){
+            throw new CustomException("此工装夹具类型已添加!");
+        }
+        TmToolType type = toolTypeService.selectTmToolTypeByToolTypeId(mdWorkstationTool.getToolTypeId());
+        mdWorkstationTool.setToolTypeCode(type.getToolTypeCode());
+        mdWorkstationTool.setToolTypeName(type.getToolTypeName());
+        return toResponse(mdWorkstationToolService.updateMdWorkstationTool(mdWorkstationTool));
+    }
+
+    /**
+     * 删除工装夹具资源
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:workstation:remove')")
+    @Log(title = "工装夹具资源", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{recordIds}")
+    public Response remove(@PathVariable Long[] recordIds)
+    {
+        return toResponse(mdWorkstationToolService.deleteMdWorkstationToolByRecordIds(recordIds));
+    }
+}

+ 123 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/md/MdWorkstationWorkerController.java

@@ -0,0 +1,123 @@
+package com.miaxis.mes.controller.md;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.system.domain.SysPost;
+import com.miaxis.system.service.ISysPostService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.md.domain.MdWorkstationWorker;
+import com.miaxis.mes.md.service.IMdWorkstationWorkerService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 人力资源Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-12
+ */
+@RestController
+@RequestMapping("/mes/md/workstationworker")
+public class MdWorkstationWorkerController extends BaseController
+{
+    @Autowired
+    private IMdWorkstationWorkerService mdWorkstationWorkerService;
+
+    @Autowired
+    private ISysPostService sysPostService;
+
+    /**
+     * 查询人力资源列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(MdWorkstationWorker mdWorkstationWorker)
+    {
+        startPage();
+        List<MdWorkstationWorker> list = mdWorkstationWorkerService.selectMdWorkstationWorkerList(mdWorkstationWorker);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出人力资源列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:workstation:export')")
+    @Log(title = "人力资源", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, MdWorkstationWorker mdWorkstationWorker)
+    {
+        List<MdWorkstationWorker> list = mdWorkstationWorkerService.selectMdWorkstationWorkerList(mdWorkstationWorker);
+        ExcelUtil<MdWorkstationWorker> util = new ExcelUtil<MdWorkstationWorker>(MdWorkstationWorker.class);
+        return util.exportExcel( list, "人力资源数据");
+    }
+
+    /**
+     * 获取人力资源详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:workstation:query')")
+    @GetMapping(value = "/{recordId}")
+    public Response getInfo(@PathVariable("recordId") Long recordId)
+    {
+        return Response.success(mdWorkstationWorkerService.selectMdWorkstationWorkerByRecordId(recordId));
+    }
+
+    /**
+     * 新增人力资源
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:workstation:add')")
+    @Log(title = "人力资源", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody MdWorkstationWorker mdWorkstationWorker)
+    {
+        SysPost post = sysPostService.selectPostById(mdWorkstationWorker.getPostId());
+        mdWorkstationWorker.setPostCode(post.getPostCode());
+        mdWorkstationWorker.setPostName(post.getPostName());
+        if(UserConstants.NOT_UNIQUE.equals(mdWorkstationWorkerService.checkPostExist(mdWorkstationWorker))){
+            throw new CustomException("此岗位已经添加!");
+        }
+        return toResponse(mdWorkstationWorkerService.insertMdWorkstationWorker(mdWorkstationWorker));
+    }
+
+    /**
+     * 修改人力资源
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:workstation:edit')")
+    @Log(title = "人力资源", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody MdWorkstationWorker mdWorkstationWorker)
+    {
+        SysPost post = sysPostService.selectPostById(mdWorkstationWorker.getPostId());
+        mdWorkstationWorker.setPostCode(post.getPostCode());
+        mdWorkstationWorker.setPostName(post.getPostName());
+        if(UserConstants.NOT_UNIQUE.equals(mdWorkstationWorkerService.checkPostExist(mdWorkstationWorker))){
+            throw new CustomException("此岗位已经添加!");
+        }
+        return toResponse(mdWorkstationWorkerService.updateMdWorkstationWorker(mdWorkstationWorker));
+    }
+
+    /**
+     * 删除人力资源
+     */
+    @PreAuthorize("@ss.hasPermi('mes:md:workstation:remove')")
+    @Log(title = "人力资源", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{recordIds}")
+    public Response remove(@PathVariable Long[] recordIds)
+    {
+        return toResponse(mdWorkstationWorkerService.deleteMdWorkstationWorkerByRecordIds(recordIds));
+    }
+}

+ 309 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/ProFeedbackController.java

@@ -0,0 +1,309 @@
+package com.miaxis.mes.controller.pro;
+
+import cn.hutool.core.collection.CollectionUtil;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.md.domain.MdWorkstation;
+import com.miaxis.mes.md.service.IMdWorkstationService;
+import com.miaxis.mes.pro.domain.ProFeedback;
+import com.miaxis.mes.pro.domain.ProRouteProcess;
+import com.miaxis.mes.pro.domain.ProTask;
+import com.miaxis.mes.pro.domain.ProWorkorder;
+import com.miaxis.mes.pro.service.IProFeedbackService;
+import com.miaxis.mes.pro.service.IProRouteProcessService;
+import com.miaxis.mes.pro.service.IProTaskService;
+import com.miaxis.mes.pro.service.IProWorkorderService;
+import com.miaxis.mes.wm.domain.WmItemConsume;
+import com.miaxis.mes.wm.domain.WmProductProduce;
+import com.miaxis.mes.wm.domain.tx.ItemConsumeTxBean;
+import com.miaxis.mes.wm.domain.tx.ProductProductTxBean;
+import com.miaxis.mes.wm.service.IStorageCoreService;
+import com.miaxis.mes.wm.service.IWmItemConsumeService;
+import com.miaxis.mes.wm.service.IWmProductProduceService;
+import com.miaxis.system.strategy.AutoCodeUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 生产报工记录Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-07-10
+ */
+@RestController
+@RequestMapping("/mes/pro/feedback")
+public class ProFeedbackController extends BaseController
+{
+    @Autowired
+    private IProFeedbackService proFeedbackService;
+
+    @Autowired
+    private IProTaskService proTaskService;
+
+    @Autowired
+    private IProRouteProcessService proRouteProcessService;
+
+    @Autowired
+    private IProWorkorderService proWorkorderService;
+
+    @Autowired
+    private IMdWorkstationService mdWorkstationService;
+
+    @Autowired
+    private IWmItemConsumeService wmItemConsumeService;
+
+    @Autowired
+    private IWmProductProduceService wmProductProduceService;
+
+    @Autowired
+    private IStorageCoreService storageCoreService;
+
+    @Autowired
+    private AutoCodeUtil autoCodeUtil;
+
+    /**
+     * 查询生产报工记录列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(ProFeedback proFeedback)
+    {
+        startPage();
+        List<ProFeedback> list = proFeedbackService.selectProFeedbackList(proFeedback);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出生产报工记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:feedback:export')")
+    @Log(title = "生产报工记录", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, ProFeedback proFeedback)
+    {
+        List<ProFeedback> list = proFeedbackService.selectProFeedbackList(proFeedback);
+        ExcelUtil<ProFeedback> util = new ExcelUtil<ProFeedback>(ProFeedback.class);
+        return util.exportExcel( list, "生产报工记录数据");
+    }
+
+    /**
+     * 获取生产报工记录详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:feedback:query')")
+    @GetMapping(value = "/{recordId}")
+    public Response getInfo(@PathVariable("recordId") Long recordId)
+    {
+        return Response.success(proFeedbackService.selectProFeedbackByRecordId(recordId));
+    }
+
+    /**
+     * 新增生产报工记录
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:feedback:add')")
+    @Log(title = "生产报工记录", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody ProFeedback proFeedback)
+    {
+        MdWorkstation workstation = mdWorkstationService.selectMdWorkstationByWorkstationId(proFeedback.getWorkstationId());
+        if(StringUtils.isNotNull(workstation)){
+            proFeedback.setProcessId(workstation.getProcessId());
+            proFeedback.setProcessCode(workstation.getProcessCode());
+            proFeedback.setProcessName(workstation.getProcessName());
+        }else {
+            throw new CustomException("当前生产任务对应的工作站不存在!");
+        }
+        //检查对应的工艺路线和工序配置
+        if(StringUtils.isNotNull(proFeedback.getRouteId())&& StringUtils.isNotNull(proFeedback.getProcessId())){
+            ProRouteProcess param = new ProRouteProcess();
+            param.setRouteId(proFeedback.getRouteId());
+            param.setProcessId(proFeedback.getProcessId());
+            List<ProRouteProcess> processes = proRouteProcessService.selectProRouteProcessList(param);
+            if(CollectionUtil.isEmpty(processes)){
+                throw new CustomException("未找到生产任务对应的工艺工序配置!");
+            }
+        }else {
+            throw new CustomException("当前生产任务对应的工艺工序配置无效!");
+        }
+
+        //检查数量
+        if(UserConstants.YES.equals(proFeedback.getIsCheck())){
+            if(!StringUtils.isNotNull(proFeedback.getQuantityUncheck())){
+                throw new CustomException("请输入待检测数量!");
+            }
+        }else {
+            if(!StringUtils.isNotNull(proFeedback.getQuantityQualified()) || !StringUtils.isNotNull(proFeedback.getQuantityUnquanlified())){
+                throw new CustomException("请输入合格品和不良品数量!");
+            }
+        }
+        String feedbackCode = autoCodeUtil.genSerialCode(UserConstants.FEEDBACK_CODE,"");
+        proFeedback.setFeedbackCode(feedbackCode);
+        proFeedback.setCreateBy(getUsername());
+        return toResponse(proFeedbackService.insertProFeedback(proFeedback));
+    }
+
+    /**
+     * 修改生产报工记录
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:feedback:edit')")
+    @Log(title = "生产报工记录", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody ProFeedback proFeedback)
+    {
+        MdWorkstation workstation = mdWorkstationService.selectMdWorkstationByWorkstationId(proFeedback.getWorkstationId());
+        if(StringUtils.isNotNull(workstation)){
+            proFeedback.setProcessId(workstation.getProcessId());
+            proFeedback.setProcessCode(workstation.getProcessCode());
+            proFeedback.setProcessName(workstation.getProcessName());
+        }else {
+            throw new CustomException("当前生产任务对应的工作站不存在!");
+        }
+
+        //检查对应的工艺路线和工序配置
+        if(StringUtils.isNotNull(proFeedback.getRouteId())&& StringUtils.isNotNull(proFeedback.getProcessId())){
+            ProRouteProcess param = new ProRouteProcess();
+            param.setRouteId(proFeedback.getRouteId());
+            param.setProcessId(proFeedback.getProcessId());
+            List<ProRouteProcess> processes = proRouteProcessService.selectProRouteProcessList(param);
+            if(CollectionUtil.isEmpty(processes)){
+                throw new CustomException("未找到生产任务对应的工艺工序配置!");
+            }
+        }else {
+            throw new CustomException("当前生产任务对应的工艺工序配置无效!");
+        }
+
+        //检查数量
+        if(UserConstants.YES.equals(proFeedback.getIsCheck())){
+            if(!StringUtils.isNotNull(proFeedback.getQuantityUncheck())){
+                throw new CustomException("当前工作站报工需要经过质检确认,请输入待检测数量!");
+            }
+        }else {
+            if(!StringUtils.isNotNull(proFeedback.getQuantityQualified()) || !StringUtils.isNotNull(proFeedback.getQuantityUnquanlified())){
+                throw new CustomException("请输入合格品和不良品数量!");
+            }
+        }
+        return toResponse(proFeedbackService.updateProFeedback(proFeedback));
+    }
+
+    /**
+     * 删除生产报工记录
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:feedback:remove')")
+    @Log(title = "生产报工记录", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{recordIds}")
+    public Response remove(@PathVariable Long[] recordIds)
+    {
+        return toResponse(proFeedbackService.deleteProFeedbackByRecordIds(recordIds));
+    }
+
+    /**
+     * 执行报工
+     * 1.更新生产任务和生产工单的进度
+     * 2.物料消耗
+     * 3.产品产出
+     * @param recordId
+     * @return
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:feedback:edit')")
+    @Log(title = "生产报工执行", businessType = BusinessTypeEnum.UPDATE)
+    @Transactional
+    @PutMapping("/{recordId}")
+    public Response execute(@PathVariable("recordId") Long recordId){
+
+        if(!StringUtils.isNotNull(recordId)){
+            throw new CustomException("请先保存单据");
+        }
+
+        ProFeedback feedback= proFeedbackService.selectProFeedbackByRecordId(recordId);
+        if(feedback.getQuantityFeedback().compareTo(BigDecimal.ZERO) !=1){
+            throw new CustomException("报工数量必须大于0");
+        }
+
+        ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(feedback.getWorkorderId());
+
+        ProTask task = proTaskService.selectProTaskByTaskId(feedback.getTaskId());
+
+        //判断当前生产任务的状态,如果已经完成则不能再报工
+        if(UserConstants.ORDER_STATUS_FINISHED.equals(task.getStatus())){
+            throw new CustomException("当前生产工单的状态为已完成,不能继续报工,请刷新生产任务列表!");
+        }
+
+        //仍旧有待检数量时不能执行
+        if(StringUtils.isNotNull(feedback.getQuantityUncheck()) && feedback.getQuantityUncheck().compareTo(BigDecimal.ZERO) >0){
+            throw new CustomException("当前报工单未完成检验(待检数量大于0),无法执行报工!");
+        }
+
+        //更新生产任务的生产数量
+        BigDecimal quantityProduced,quantityQuanlify,quantityUnquanlify;
+        quantityQuanlify = task.getQuantityQuanlify()==null? new BigDecimal(0):task.getQuantityQuanlify();
+        quantityUnquanlify = task.getQuantityUnquanlify() ==null? new BigDecimal(0):task.getQuantityUnquanlify();
+        quantityProduced = task.getQuantityProduced()==null? new BigDecimal(0):task.getQuantityProduced();
+        task.setQuantityProduced(quantityProduced.add(feedback.getQuantityFeedback()));
+        task.setQuantityQuanlify(quantityQuanlify.add(feedback.getQuantityQualified()));
+        task.setQuantityUnquanlify(quantityUnquanlify.add(feedback.getQuantityUnquanlified()));
+
+        proTaskService.updateProTask(task);
+
+        //如果是关键工序,则更新当前工单的已生产数量,进行产品产出动作
+        if(proRouteProcessService.checkKeyProcess(feedback)){
+            //更新生产工单的生产数量
+            BigDecimal produced = workorder.getQuantityProduced() == null?new BigDecimal(0):workorder.getQuantityProduced();
+            BigDecimal feedBackQuantity = feedback.getQuantityFeedback() ==null?new BigDecimal(0):feedback.getQuantityFeedback();
+            workorder.setQuantityProduced( produced.add(feedBackQuantity));
+            proWorkorderService.updateProWorkorder(workorder);
+
+            //生成产品产出记录单
+            WmProductProduce productRecord = wmProductProduceService.generateProductProduce(feedback);
+            //执行产品产出入线边库
+            executeProductProduce(productRecord);
+        }
+
+        //根据当前工序的物料BOM配置,进行物料消耗
+        //先生成消耗单
+        WmItemConsume itemConsume = wmItemConsumeService.generateItemConsume(feedback);
+        if(StringUtils.isNotNull(itemConsume)){
+            //再执行库存消耗动作
+            executeItemConsume(itemConsume);
+        }
+
+        //更新报工单的状态
+        feedback.setStatus(UserConstants.ORDER_STATUS_FINISHED);
+        proFeedbackService.updateProFeedback(feedback);
+        return Response.success();
+    }
+
+    /**
+     * 执行产品产出入线边库动作
+     * @param record
+     */
+    private void executeProductProduce(WmProductProduce record){
+        List<ProductProductTxBean> beans = wmProductProduceService.getTxBeans(record.getRecordId());
+        storageCoreService.processProductProduce(beans);
+        record.setStatus(UserConstants.ORDER_STATUS_FINISHED);
+        wmProductProduceService.updateWmProductProduce(record);
+    }
+
+    /**
+     * 执行物料消耗库存动作
+     * @param record
+     */
+    private void executeItemConsume(WmItemConsume record){
+        //需要在此处进行分批次领料的线边库扣减
+        List<ItemConsumeTxBean> beans = wmItemConsumeService.getTxBeans(record.getRecordId());
+        storageCoreService.processItemConsume(beans);
+        record.setStatus(UserConstants.ORDER_STATUS_FINISHED);
+        wmItemConsumeService.updateWmItemConsume(record);
+    }
+
+}

+ 103 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/ProProcessContentController.java

@@ -0,0 +1,103 @@
+package com.miaxis.mes.controller.pro;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.pro.domain.ProProcessContent;
+import com.miaxis.mes.pro.service.IProProcessContentService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 生产工序内容Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-12
+ */
+@RestController
+@RequestMapping("/mes/pro/processcontent")
+public class ProProcessContentController extends BaseController
+{
+    @Autowired
+    private IProProcessContentService proProcessContentService;
+
+    /**
+     * 查询生产工序内容列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(ProProcessContent proProcessContent)
+    {
+        startPage();
+        List<ProProcessContent> list = proProcessContentService.selectProProcessContentList(proProcessContent);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出生产工序内容列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:process:export')")
+    @Log(title = "生产工序内容", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, ProProcessContent proProcessContent)
+    {
+        List<ProProcessContent> list = proProcessContentService.selectProProcessContentList(proProcessContent);
+        ExcelUtil<ProProcessContent> util = new ExcelUtil<ProProcessContent>(ProProcessContent.class);
+        return util.exportExcel( list, "生产工序内容数据");
+    }
+
+    /**
+     * 获取生产工序内容详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:process:query')")
+    @GetMapping(value = "/{contentId}")
+    public Response getInfo(@PathVariable("contentId") Long contentId)
+    {
+        return Response.success(proProcessContentService.selectProProcessContentByContentId(contentId));
+    }
+
+    /**
+     * 新增生产工序内容
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:process:add')")
+    @Log(title = "生产工序内容", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody ProProcessContent proProcessContent)
+    {
+        return toResponse(proProcessContentService.insertProProcessContent(proProcessContent));
+    }
+
+    /**
+     * 修改生产工序内容
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:process:edit')")
+    @Log(title = "生产工序内容", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody ProProcessContent proProcessContent)
+    {
+        return toResponse(proProcessContentService.updateProProcessContent(proProcessContent));
+    }
+
+    /**
+     * 删除生产工序内容
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:process:remove')")
+    @Log(title = "生产工序内容", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{contentIds}")
+    public Response remove(@PathVariable Long[] contentIds)
+    {
+        return toResponse(proProcessContentService.deleteProProcessContentByContentIds(contentIds));
+    }
+}

+ 123 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/ProProcessController.java

@@ -0,0 +1,123 @@
+package com.miaxis.mes.controller.pro;
+
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.pro.domain.ProProcess;
+import com.miaxis.mes.pro.service.IProProcessService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 生产工序Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-11
+ */
+@RestController
+@RequestMapping("/mes/pro/process")
+public class ProProcessController extends BaseController
+{
+    @Autowired
+    private IProProcessService proProcessService;
+
+    /**
+     * 查询生产工序列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(ProProcess proProcess)
+    {
+        startPage();
+        List<ProProcess> list = proProcessService.selectProProcessList(proProcess);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 查询所有可用工序的清单
+     * @return
+     */
+    @GetMapping("/listAll")
+    public Response listAll(){
+        ProProcess process = new ProProcess();
+        process.setEnableFlag("Y");
+        List<ProProcess> list =proProcessService.selectProProcessList(process);
+        return Response.success(list);
+    }
+
+    /**
+     * 导出生产工序列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:process:export')")
+    @Log(title = "生产工序", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, ProProcess proProcess)
+    {
+        List<ProProcess> list = proProcessService.selectProProcessList(proProcess);
+        ExcelUtil<ProProcess> util = new ExcelUtil<ProProcess>(ProProcess.class);
+        return util.exportExcel( list, "生产工序数据");
+    }
+
+    /**
+     * 获取生产工序详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:process:query')")
+    @GetMapping(value = "/{processId}")
+    public Response getInfo(@PathVariable("processId") Long processId)
+    {
+        return Response.success(proProcessService.selectProProcessByProcessId(processId));
+    }
+
+    /**
+     * 新增生产工序
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:process:add')")
+    @Log(title = "生产工序", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody ProProcess proProcess)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(proProcessService.checkProcessCodeUnique(proProcess))){
+            throw new CustomException("工序编码已存在!");
+        }
+        if(UserConstants.NOT_UNIQUE.equals(proProcessService.checkProcessNameUnique(proProcess))){
+            throw new CustomException("工序名称已存在!");
+        }
+        return toResponse(proProcessService.insertProProcess(proProcess));
+    }
+
+    /**
+     * 修改生产工序
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:process:edit')")
+    @Log(title = "生产工序", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody ProProcess proProcess)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(proProcessService.checkProcessCodeUnique(proProcess))){
+            throw new CustomException("工序编码已存在!");
+        }
+        if(UserConstants.NOT_UNIQUE.equals(proProcessService.checkProcessNameUnique(proProcess))){
+            throw new CustomException("工序名称已存在!");
+        }
+        return toResponse(proProcessService.updateProProcess(proProcess));
+    }
+
+    /**
+     * 删除生产工序
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:process:remove')")
+    @Log(title = "生产工序", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{processIds}")
+    public Response remove(@PathVariable Long[] processIds)
+    {
+        return toResponse(proProcessService.deleteProProcessByProcessIds(processIds));
+    }
+}

+ 132 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/ProRouteController.java

@@ -0,0 +1,132 @@
+package com.miaxis.mes.controller.pro;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.mes.pro.service.IProRouteProcessService;
+import com.miaxis.mes.pro.service.IProRouteProductBomService;
+import com.miaxis.mes.pro.service.IProRouteProductService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.pro.domain.ProRoute;
+import com.miaxis.mes.pro.service.IProRouteService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 工艺路线Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-12
+ */
+@RestController
+@RequestMapping("/mes/pro/proroute")
+public class ProRouteController extends BaseController
+{
+    @Autowired
+    private IProRouteService proRouteService;
+
+    @Autowired
+    private IProRouteProcessService proRouteProcessService;
+
+    @Autowired
+    private IProRouteProductService proRouteProductService;
+
+    @Autowired
+    private IProRouteProductBomService proRouteProductBomService;
+
+    /**
+     * 查询工艺路线列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(ProRoute proRoute)
+    {
+        startPage();
+        List<ProRoute> list = proRouteService.selectProRouteList(proRoute);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出工艺路线列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:proroute:export')")
+    @Log(title = "工艺路线", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, ProRoute proRoute)
+    {
+        List<ProRoute> list = proRouteService.selectProRouteList(proRoute);
+        ExcelUtil<ProRoute> util = new ExcelUtil<ProRoute>(ProRoute.class);
+        return util.exportExcel( list, "工艺路线数据");
+    }
+
+    /**
+     * 获取工艺路线详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:proroute:query')")
+    @GetMapping(value = "/{routeId}")
+    public Response getInfo(@PathVariable("routeId") Long routeId)
+    {
+        return Response.success(proRouteService.selectProRouteByRouteId(routeId));
+    }
+
+    /**
+     * 新增工艺路线
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:proroute:add')")
+    @Log(title = "工艺路线", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody ProRoute proRoute)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(proRouteService.checkRouteCodeUnique(proRoute))){
+            throw new CustomException("工艺路线编号已存在!");
+        }
+        return toResponse(proRouteService.insertProRoute(proRoute));
+    }
+
+    /**
+     * 修改工艺路线
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:proroute:edit')")
+    @Log(title = "工艺路线", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody ProRoute proRoute)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(proRouteService.checkRouteCodeUnique(proRoute))){
+            throw new CustomException("工艺路线编号已存在!");
+        }
+        return toResponse(proRouteService.updateProRoute(proRoute));
+    }
+
+    /**
+     * 删除工艺路线
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:proroute:remove')")
+    @Log(title = "工艺路线", businessType = BusinessTypeEnum.DELETE)
+    @Transactional
+	@DeleteMapping("/{routeIds}")
+    public Response remove(@PathVariable Long[] routeIds)
+    {
+        for (Long routeId:routeIds
+             ) {
+            proRouteProcessService.deleteByRouteId(routeId);
+            proRouteProductService.deleteByRouteId(routeId);
+            proRouteProductBomService.deleteByRouteId(routeId);
+        }
+        return toResponse(proRouteService.deleteProRouteByRouteIds(routeIds));
+    }
+}

+ 204 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/ProRouteProcessController.java

@@ -0,0 +1,204 @@
+package com.miaxis.mes.controller.pro;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import cn.hutool.core.collection.CollUtil;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.mes.pro.domain.ProProcess;
+import com.miaxis.mes.pro.domain.ProRouteProduct;
+import com.miaxis.mes.pro.service.IProProcessService;
+import com.miaxis.mes.pro.service.IProRouteProductService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.pro.domain.ProRouteProcess;
+import com.miaxis.mes.pro.service.IProRouteProcessService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 工艺组成Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-13
+ */
+@RestController
+@RequestMapping("/mes/pro/routeprocess")
+public class ProRouteProcessController extends BaseController
+{
+    @Autowired
+    private IProRouteProcessService proRouteProcessService;
+
+    @Autowired
+    private IProRouteProductService proRouteProductService;
+
+    @Autowired
+    private IProProcessService proProcessService;
+
+    /**
+     * 查询工艺组成列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(ProRouteProcess proRouteProcess)
+    {
+        startPage();
+        List<ProRouteProcess> list = proRouteProcessService.selectProRouteProcessList(proRouteProcess);
+        return toResponsePageInfo(list);
+    }
+
+
+    /**
+     * 查询指定产品的工艺组成
+     * @return
+     */
+    @GetMapping("/listProductProcess/{productId}")
+    public Response listProductProcess(@PathVariable("productId") Long productId){
+        ProRouteProduct proRouteProduct = new ProRouteProduct();
+        proRouteProduct.setItemId(productId);
+        List<ProRouteProduct> products = proRouteProductService.selectProRouteProductList(proRouteProduct);
+        if(CollUtil.isNotEmpty(products)){
+            ProRouteProduct product = products.get(0);
+            ProRouteProcess param = new ProRouteProcess();
+            param.setRouteId(product.getRouteId());
+            return Response.success(proRouteProcessService.selectProRouteProcessList(param));
+        }else {
+            throw new CustomException("当前产品未配置工艺路线!");
+        }
+    }
+
+
+    /**
+     * 导出工艺组成列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:proroute:export')")
+    @Log(title = "工艺组成", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, ProRouteProcess proRouteProcess)
+    {
+        List<ProRouteProcess> list = proRouteProcessService.selectProRouteProcessList(proRouteProcess);
+        ExcelUtil<ProRouteProcess> util = new ExcelUtil<ProRouteProcess>(ProRouteProcess.class);
+        return util.exportExcel( list, "工艺组成数据");
+    }
+
+    /**
+     * 获取工艺组成详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:proroute:query')")
+    @GetMapping(value = "/{recordId}")
+    public Response getInfo(@PathVariable("recordId") Long recordId)
+    {
+        return Response.success(proRouteProcessService.selectProRouteProcessByRecordId(recordId));
+    }
+
+    /**
+     * 新增工艺组成
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:proroute:add')")
+    @Log(title = "工艺组成", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody ProRouteProcess proRouteProcess)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(proRouteProcessService.checkOrderNumExists(proRouteProcess))){
+            throw new CustomException("序号已存在!");
+        }
+        if(UserConstants.NOT_UNIQUE.equals(proRouteProcessService.checkProcessExists(proRouteProcess))){
+            throw new CustomException("不能重复添加工序!");
+        }
+        if(UserConstants.YES.equals(proRouteProcess.getKeyFlag()) && UserConstants.NOT_UNIQUE.equals(proRouteProcessService.checkUpdateFlagUnique(proRouteProcess))){
+            throw new CustomException("当前工艺路线已经指定过关键工序");
+        }
+        ProProcess process = proProcessService.selectProProcessByProcessId(proRouteProcess.getProcessId());
+        proRouteProcess.setProcessCode(process.getProcessCode());
+        proRouteProcess.setProcessName(process.getProcessName());
+
+        //更新上一个工序的nextProcess
+        ProRouteProcess preProcess = proRouteProcessService.findPreProcess(proRouteProcess);
+        if(StringUtils.isNotNull(preProcess)){
+            preProcess.setNextProcessId(proRouteProcess.getProcessId());
+            preProcess.setNextProcessCode(proRouteProcess.getProcessCode());
+            preProcess.setNextProcessName(proRouteProcess.getProcessName());
+            proRouteProcessService.updateProRouteProcess(preProcess);
+        }
+
+        //设置当前工序的nextProcess
+        ProRouteProcess nextProcess = proRouteProcessService.findNextProcess(proRouteProcess);
+        if(StringUtils.isNotNull(nextProcess)){
+            proRouteProcess.setNextProcessId(nextProcess.getProcessId());
+            proRouteProcess.setNextProcessCode(nextProcess.getProcessCode());
+            proRouteProcess.setNextProcessName(nextProcess.getProcessName());
+        }else{
+            proRouteProcess.setNextProcessId(0L);
+            proRouteProcess.setNextProcessName("无");
+        }
+
+        return toResponse(proRouteProcessService.insertProRouteProcess(proRouteProcess));
+    }
+
+    /**
+     * 修改工艺组成
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:proroute:edit')")
+    @Log(title = "工艺组成", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody ProRouteProcess proRouteProcess)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(proRouteProcessService.checkOrderNumExists(proRouteProcess))){
+            throw new CustomException("序号已存在!");
+        }
+        if(UserConstants.NOT_UNIQUE.equals(proRouteProcessService.checkProcessExists(proRouteProcess))){
+            throw new CustomException("不能重复添加工序!");
+        }
+        if(UserConstants.YES.equals(proRouteProcess.getKeyFlag()) && UserConstants.NOT_UNIQUE.equals(proRouteProcessService.checkUpdateFlagUnique(proRouteProcess))){
+            throw new CustomException("当前工艺路线已经指定过关键工序");
+        }
+        ProProcess process = proProcessService.selectProProcessByProcessId(proRouteProcess.getProcessId());
+        proRouteProcess.setProcessCode(process.getProcessCode());
+        proRouteProcess.setProcessName(process.getProcessName());
+
+        //更新上一个工序的nextProcess
+        ProRouteProcess preProcess = proRouteProcessService.findPreProcess(proRouteProcess);
+        if(StringUtils.isNotNull(preProcess)){
+            preProcess.setNextProcessId(proRouteProcess.getProcessId());
+            preProcess.setNextProcessCode(proRouteProcess.getProcessCode());
+            preProcess.setNextProcessName(proRouteProcess.getProcessName());
+            proRouteProcessService.updateProRouteProcess(preProcess);
+        }
+
+        //设置当前工序的nextProcess
+        ProRouteProcess nextProcess = proRouteProcessService.findNextProcess(proRouteProcess);
+        if(StringUtils.isNotNull(nextProcess)){
+            proRouteProcess.setNextProcessId(nextProcess.getProcessId());
+            proRouteProcess.setNextProcessCode(nextProcess.getProcessCode());
+            proRouteProcess.setNextProcessName(nextProcess.getProcessName());
+        }else{
+            proRouteProcess.setNextProcessId(0L);
+            proRouteProcess.setNextProcessName("无");
+        }
+
+        return toResponse(proRouteProcessService.updateProRouteProcess(proRouteProcess));
+    }
+
+    /**
+     * 删除工艺组成
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:proroute:remove')")
+    @Log(title = "工艺组成", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{recordIds}")
+    public Response remove(@PathVariable Long[] recordIds)
+    {
+        return toResponse(proRouteProcessService.deleteProRouteProcessByRecordIds(recordIds));
+    }
+}

+ 111 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/ProRouteProductBomController.java

@@ -0,0 +1,111 @@
+package com.miaxis.mes.controller.pro;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.miaxis.common.constant.UserConstants;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.pro.domain.ProRouteProductBom;
+import com.miaxis.mes.pro.service.IProRouteProductBomService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 产品制程物料BOMController
+ * 
+ * @author yinjinlu
+ * @date 2022-09-12
+ */
+@RestController
+@RequestMapping("/mes/pro/routeproductbom")
+public class ProRouteProductBomController extends BaseController
+{
+    @Autowired
+    private IProRouteProductBomService proRouteProductBomService;
+
+    /**
+     * 查询产品制程物料BOM列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(ProRouteProductBom proRouteProductBom)
+    {
+        startPage();
+        List<ProRouteProductBom> list = proRouteProductBomService.selectProRouteProductBomList(proRouteProductBom);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出产品制程物料BOM列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:proroute:export')")
+    @Log(title = "产品制程物料BOM", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, ProRouteProductBom proRouteProductBom)
+    {
+        List<ProRouteProductBom> list = proRouteProductBomService.selectProRouteProductBomList(proRouteProductBom);
+        ExcelUtil<ProRouteProductBom> util = new ExcelUtil<ProRouteProductBom>(ProRouteProductBom.class);
+        return util.exportExcel( list, "产品制程物料BOM数据");
+    }
+
+    /**
+     * 获取产品制程物料BOM详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:proroute:query')")
+    @GetMapping(value = "/{recordId}")
+    public Response getInfo(@PathVariable("recordId") Long recordId)
+    {
+        return Response.success(proRouteProductBomService.selectProRouteProductBomByRecordId(recordId));
+    }
+
+    /**
+     * 新增产品制程物料BOM
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:proroute:add')")
+    @Log(title = "产品制程物料BOM", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody ProRouteProductBom proRouteProductBom)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(proRouteProductBomService.checkUnique(proRouteProductBom))){
+            throw new CustomException("当前BOM物料在此工序已经配置过!");
+        }
+        return toResponse(proRouteProductBomService.insertProRouteProductBom(proRouteProductBom));
+    }
+
+    /**
+     * 修改产品制程物料BOM
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:proroute:edit')")
+    @Log(title = "产品制程物料BOM", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody ProRouteProductBom proRouteProductBom)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(proRouteProductBomService.checkUnique(proRouteProductBom))){
+            throw new CustomException("当前BOM物料在此工序已经配置过!");
+        }
+        return toResponse(proRouteProductBomService.updateProRouteProductBom(proRouteProductBom));
+    }
+
+    /**
+     * 删除产品制程物料BOM
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:proroute:remove')")
+    @Log(title = "产品制程物料BOM", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{recordIds}")
+    public Response remove(@PathVariable Long[] recordIds)
+    {
+        return toResponse(proRouteProductBomService.deleteProRouteProductBomByRecordIds(recordIds));
+    }
+}

+ 150 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/ProRouteProductController.java

@@ -0,0 +1,150 @@
+package com.miaxis.mes.controller.pro;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import cn.hutool.core.collection.CollUtil;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.mes.pro.domain.ProRouteProductBom;
+import com.miaxis.mes.pro.service.IProRouteProductBomService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.pro.domain.ProRouteProduct;
+import com.miaxis.mes.pro.service.IProRouteProductService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 产品制程Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-14
+ */
+@RestController
+@RequestMapping("/mes/pro/routeproduct")
+public class ProRouteProductController extends BaseController
+{
+    @Autowired
+    private IProRouteProductService proRouteProductService;
+
+    @Autowired
+    private IProRouteProductBomService proRouteProductBomService;
+
+    /**
+     * 查询产品制程列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(ProRouteProduct proRouteProduct)
+    {
+        startPage();
+        List<ProRouteProduct> list = proRouteProductService.selectProRouteProductList(proRouteProduct);
+        return toResponsePageInfo(list);
+    }
+
+
+    /**
+     * 导出产品制程列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:proroute:export')")
+    @Log(title = "产品制程", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, ProRouteProduct proRouteProduct)
+    {
+        List<ProRouteProduct> list = proRouteProductService.selectProRouteProductList(proRouteProduct);
+        ExcelUtil<ProRouteProduct> util = new ExcelUtil<ProRouteProduct>(ProRouteProduct.class);
+        return util.exportExcel( list, "产品制程数据");
+    }
+
+    /**
+     * 获取产品制程详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:proroute:query')")
+    @GetMapping(value = "/{recordId}")
+    public Response getInfo(@PathVariable("recordId") Long recordId)
+    {
+        return Response.success(proRouteProductService.selectProRouteProductByRecordId(recordId));
+    }
+
+    /**
+     * 新增产品制程
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:proroute:add')")
+    @Log(title = "产品制程", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody ProRouteProduct proRouteProduct)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(proRouteProductService.checkItemUnique(proRouteProduct))){
+            throw new CustomException("此产品已配置了工艺路线!");
+        }
+        return toResponse(proRouteProductService.insertProRouteProduct(proRouteProduct));
+    }
+
+    /**
+     * 修改产品制程
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:proroute:edit')")
+    @Log(title = "产品制程", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody ProRouteProduct proRouteProduct)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(proRouteProductService.checkItemUnique(proRouteProduct))){
+            throw new CustomException("此产品已配置了工艺路线!");
+        }
+        return toResponse(proRouteProductService.updateProRouteProduct(proRouteProduct));
+    }
+
+    /**
+     * 更改产品的生产路线
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:proroute:edit')")
+    @Log(title = "产品制程", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping("/move")
+    public Response move(@RequestBody ProRouteProduct proRouteProduct){
+        ProRouteProduct param = new ProRouteProduct();
+        param.setItemId(proRouteProduct.getItemId());
+        param.setRouteId(proRouteProduct.getRouteId());
+        List<ProRouteProduct> products = proRouteProductService.selectProRouteProductList(param);
+        int ret =1;
+        if(CollUtil.isNotEmpty(products)){
+            ProRouteProduct product = products.get(0);
+            product.setRouteId(proRouteProduct.getRouteId());
+            ret =proRouteProductService.updateProRouteProduct(product);
+        }
+        return toResponse(ret);
+    }
+
+
+    /**
+     * 删除产品制程
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:proroute:remove')")
+    @Log(title = "产品制程", businessType = BusinessTypeEnum.DELETE)
+    @Transactional
+	@DeleteMapping("/{recordIds}")
+    public Response remove(@PathVariable Long[] recordIds)
+    {
+        for (Long recordId:recordIds
+             ) {
+            ProRouteProduct product = proRouteProductService.selectProRouteProductByRecordId(recordId);
+            ProRouteProductBom bom = new ProRouteProductBom();
+            bom.setRouteId(product.getRouteId());
+            bom.setProductId(product.getItemId());
+            proRouteProductBomService.deleteByRouteIdAndProductId(bom);
+        }
+
+        return toResponse(proRouteProductService.deleteProRouteProductByRecordIds(recordIds));
+    }
+}

+ 312 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/ProTaskController.java

@@ -0,0 +1,312 @@
+package com.miaxis.mes.controller.pro;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import cn.hutool.core.collection.CollUtil;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.mes.pro.domain.*;
+import com.miaxis.mes.pro.domain.*;
+import com.miaxis.mes.pro.service.IProProcessService;
+import com.miaxis.mes.pro.service.IProRouteService;
+import com.miaxis.mes.pro.service.IProWorkorderService;
+import com.miaxis.system.strategy.AutoCodeUtil;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.pro.service.IProTaskService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 生产任务Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-14
+ */
+@RestController
+@RequestMapping("/mes/pro/protask")
+public class ProTaskController extends BaseController
+{
+    @Autowired
+    private IProTaskService proTaskService;
+
+    @Autowired
+    private IProWorkorderService proWorkorderService;
+
+    @Autowired
+    private IProProcessService proProcessService;
+
+    @Autowired
+    private IProRouteService proRouteService;
+
+    @Autowired
+    private AutoCodeUtil autoCodeUtil;
+
+    /**
+     * 查询生产任务列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(ProTask proTask)
+    {
+        startPage();
+        List<ProTask> list = proTaskService.selectProTaskList(proTask);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出生产任务列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:protask:export')")
+    @Log(title = "生产任务", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, ProTask proTask)
+    {
+        List<ProTask> list = proTaskService.selectProTaskList(proTask);
+        ExcelUtil<ProTask> util = new ExcelUtil<ProTask>(ProTask.class);
+        return util.exportExcel( list, "生产任务数据");
+    }
+
+    /**
+     * 获取生产任务详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:protask:query')")
+    @GetMapping(value = "/{taskId}")
+    public Response getInfo(@PathVariable("taskId") Long taskId)
+    {
+        return Response.success(proTaskService.selectProTaskByTaskId(taskId));
+    }
+
+    /**
+     * 获取甘特图中需要显示的TASK,包括三种类型的内容:
+     * 1.Project:基于时间范围搜索的生产工单转换而来的Project。
+     *   搜索逻辑为:默认使用当前日期作为开始时间,搜索所有需求时间大于当前时间的生产工单
+     * 2.Task:基于生产工单拆分到具体工作站后的生产任务转换而来的Task。
+     * 3.Link:根据工序与工序之间的依赖关系转换而来的Link。
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:protask:list')")
+    @GetMapping("/listGanttTaskList")
+    public Response getGanttTaskList(ProWorkorder proWorkorder){
+        GanttTask ganttTask = new GanttTask();
+        List<GanttData> ganttData = new ArrayList<GanttData>();
+        List<GanttLink> ganttLinks = new ArrayList<GanttLink>();
+
+        //查询所有的WorkOrder
+        List<ProWorkorder> workorders = proWorkorderService.selectProWorkorderList(proWorkorder);
+
+        //为每个workOrder生成type=project的GanttData
+        //为每个proTask生产type=task的GanttData
+        ProTask param = new ProTask();
+        if(CollUtil.isNotEmpty(workorders)){
+            for (ProWorkorder workorder: workorders
+                 ) {
+                //先添加当前的生产工单TASK
+                GanttData wdata = new GanttData();
+                wdata.setId("MO"+workorder.getWorkorderId().toString());
+                wdata.setText(new StringBuilder().append(workorder.getProductName()).append(workorder.getQuantity().stripTrailingZeros().toPlainString()).append(workorder.getUnitOfMeasure()).toString());//默认使用“[产品]+[数量]+[单位]”格式。
+                wdata.setProduct(workorder.getProductName());
+                wdata.setQuantity(workorder.getQuantity());
+                if(workorder.getParentId().longValue()!=0L){
+                    wdata.setParent("MO"+workorder.getParentId().toString());
+                }
+                BigDecimal produced = workorder.getQuantityProduced();
+                BigDecimal quantitiy = workorder.getQuantity();
+                wdata.setProgress( produced.divide(quantitiy,BigDecimal.ROUND_HALF_UP).floatValue());
+                wdata.setDuration(0L);
+                wdata.setType(UserConstants.GANTT_TASK_TYPE_PROJECT);
+                ganttData.add(wdata);
+
+                //查询当前生产工单下所有的生产任务
+                param.setWorkorderId(workorder.getWorkorderId());
+                List<ProTask> proTasks = proTaskService.selectProTaskList(param);
+                if(CollUtil.isNotEmpty(proTasks)){
+                    for (ProTask task:proTasks
+                         ) {
+                        GanttData data = new GanttData();
+                        data.setId(task.getTaskId().toString());//使用生产任务的ID作为甘特图TASK的ID
+                        data.setText(new StringBuilder().append(task.getItemName()).append(task.getQuantity().stripTrailingZeros().toPlainString()).append(task.getUnitOfMeasure()).toString()); //默认使用“[产品]+[数量]+[单位]”格式。
+                        data.setColor(task.getColorCode());
+                        data.setDuration(task.getDuration());
+                        data.setStart_date(task.getStartTime());
+                        data.setParent("MO"+workorder.getWorkorderId().toString());//这里要设置为"MO+生产工单ID"的格式
+                        data.setProduct(task.getItemName());
+                        data.setQuantity(task.getQuantity());
+                        data.setProcess(task.getProcessName());
+                        data.setWorkstation(task.getWorkstationName());
+                        BigDecimal taskproduced = task.getQuantityProduced();
+                        BigDecimal taskquantitiy = task.getQuantity();
+                        data.setProgress(taskproduced.divide(taskquantitiy,BigDecimal.ROUND_HALF_UP).floatValue());
+                        data.setType(UserConstants.GANTT_TASK_TYPE_TASK);
+                        ganttData.add(data);
+                    }
+                }
+            }
+        }
+
+        ganttTask.setData(ganttData);
+        ganttTask.setLinks(ganttLinks);
+        return Response.success(ganttTask);
+    }
+
+
+    /**
+     * 新增生产任务
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:protask:add')")
+    @Log(title = "生产任务", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody ProTask proTask)
+    {
+        if(proTask.getQuantity().compareTo(BigDecimal.ZERO) !=1){
+            throw new CustomException("排产数量必须大于0!");
+        }
+
+        if(!StringUtils.isNotNull(proTask.getWorkstationId())){
+            throw new CustomException("请选择工作站!");
+        }
+
+        if(proTask.getDuration()<=0){
+            throw new CustomException("生产时长必须大于0!");
+        }
+
+        //生产工单
+        ProWorkorder order = proWorkorderService.selectProWorkorderByWorkorderId(proTask.getWorkorderId());
+        proTask.setWorkorderCode(order.getWorkorderCode());
+        proTask.setWorkorderName(order.getWorkorderName());
+        proTask.setItemId(order.getProductId());
+        proTask.setItemCode(order.getProductCode());
+        proTask.setItemName(order.getProductName());
+        proTask.setSpecification(order.getProductSpc());
+        proTask.setUnitOfMeasure(order.getUnitOfMeasure());
+        proTask.setClientId(order.getClientId());
+        proTask.setClientCode(order.getClientCode());
+        proTask.setClientName(order.getClientName());
+
+        //工艺信息
+        if(StringUtils.isNotNull(proTask.getRouteId())){
+            ProRoute route = proRouteService.selectProRouteByRouteId(proTask.getRouteId());
+            if(StringUtils.isNotNull(route)){
+                proTask.setRouteCode(route.getRouteCode());
+            }else {
+                throw new CustomException("当前生产任务对应的工艺路线信息无效!"+proTask.getRouteId());
+            }
+        }
+
+        //工序信息
+        ProProcess process = proProcessService.selectProProcessByProcessId(proTask.getProcessId());
+        if(StringUtils.isNotNull(process)){
+            proTask.setProcessId(process.getProcessId());
+            proTask.setProcessCode(process.getProcessCode());
+            proTask.setProcessName(process.getProcessName());
+        }else{
+            throw new CustomException("当前生产任务对应的工序信息无效!"+proTask.getProcessId());
+        }
+
+
+        //自动生成任务编号和名称
+        proTask.setTaskCode(autoCodeUtil.genSerialCode(UserConstants.TASK_CODE,null));
+        proTask.setTaskName(new StringBuilder().append(proTask.getItemName()).append("【").append(proTask.getQuantity().toString()).append("】").append(proTask.getUnitOfMeasure()).toString());
+
+
+
+        return toResponse(proTaskService.insertProTask(proTask));
+    }
+
+    /**
+     * 修改生产任务
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:protask:edit')")
+    @Log(title = "生产任务", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody ProTask proTask)
+    {
+        ProTask theTask = proTaskService.selectProTaskByTaskId(proTask.getTaskId());
+
+        if(proTask.getQuantity().compareTo(BigDecimal.ZERO) !=1){
+            throw new CustomException("排产数量必须大于0!");
+        }
+
+        if(!StringUtils.isNotNull(proTask.getWorkstationId())){
+            proTask.setWorkstationId(theTask.getWorkstationId());
+        }
+
+        if(!StringUtils.isNotNull(proTask.getWorkorderId())){
+            proTask.setWorkorderId(theTask.getWorkorderId());
+        }
+
+        if(!StringUtils.isNotNull(proTask.getProcessId())){
+            proTask.setProcessId(theTask.getProcessId());
+        }
+
+        if(!StringUtils.isNotNull(proTask.getRouteId())){
+            proTask.setRouteId(theTask.getRouteId());
+        }
+
+        if(proTask.getDuration()<=0){
+            proTask.setDuration(theTask.getDuration());
+        }
+
+        //生产工单
+        ProWorkorder order = proWorkorderService.selectProWorkorderByWorkorderId(proTask.getWorkorderId());
+        if(!StringUtils.isNotNull(order)){
+            throw new CustomException("生产工单不存在!");
+        }
+        proTask.setWorkorderCode(order.getWorkorderCode());
+        proTask.setWorkorderName(order.getWorkorderName());
+        proTask.setItemId(order.getProductId());
+        proTask.setItemCode(order.getProductCode());
+        proTask.setItemName(order.getProductName());
+        proTask.setSpecification(order.getProductSpc());
+        proTask.setUnitOfMeasure(order.getUnitOfMeasure());
+        proTask.setClientId(order.getClientId());
+        proTask.setClientCode(order.getClientCode());
+        proTask.setClientName(order.getClientName());
+
+        //工艺信息
+        if(StringUtils.isNotNull(proTask.getRouteId())){
+            ProRoute route = proRouteService.selectProRouteByRouteId(proTask.getRouteId());
+            if(StringUtils.isNotNull(route)){
+                proTask.setRouteCode(route.getRouteCode());
+            }else {
+                throw new CustomException("当前生产任务对应的工艺路线信息无效!"+proTask.getRouteId());
+            }
+        }
+
+        //工序信息
+        ProProcess process = proProcessService.selectProProcessByProcessId(proTask.getProcessId());
+        if(StringUtils.isNotNull(process)){
+            proTask.setProcessId(process.getProcessId());
+            proTask.setProcessCode(process.getProcessCode());
+            proTask.setProcessName(process.getProcessName());
+        }else{
+            throw new CustomException("当前生产任务对应的工序信息无效!"+proTask.getProcessId());
+        }
+
+        return toResponse(proTaskService.updateProTask(proTask));
+    }
+
+    /**
+     * 删除生产任务
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:protask:remove')")
+    @Log(title = "生产任务", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{taskIds}")
+    public Response remove(@PathVariable Long[] taskIds)
+    {
+        return toResponse(proTaskService.deleteProTaskByTaskIds(taskIds));
+    }
+}

+ 98 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/ProTaskIssueController.java

@@ -0,0 +1,98 @@
+package com.miaxis.mes.controller.pro;
+
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.pro.domain.ProTaskIssue;
+import com.miaxis.mes.pro.service.IProTaskIssueService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 生产任务投料Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-07-22
+ */
+@RestController
+@RequestMapping("/mes/pro/taskissue")
+public class ProTaskIssueController extends BaseController
+{
+    @Autowired
+    private IProTaskIssueService proTaskIssueService;
+
+
+    /**
+     * 查询生产任务投料列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(ProTaskIssue proTaskIssue)
+    {
+        startPage();
+        List<ProTaskIssue> list = proTaskIssueService.selectProTaskIssueList(proTaskIssue);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出生产任务投料列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:protask:export')")
+    @Log(title = "生产任务投料", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, ProTaskIssue proTaskIssue)
+    {
+        List<ProTaskIssue> list = proTaskIssueService.selectProTaskIssueList(proTaskIssue);
+        ExcelUtil<ProTaskIssue> util = new ExcelUtil<ProTaskIssue>(ProTaskIssue.class);
+        return util.exportExcel( list, "生产任务投料数据");
+    }
+
+    /**
+     * 获取生产任务投料详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:protask:query')")
+    @GetMapping(value = "/{recordId}")
+    public Response getInfo(@PathVariable("recordId") Long recordId)
+    {
+        return Response.success(proTaskIssueService.selectProTaskIssueByRecordId(recordId));
+    }
+
+    /**
+     * 新增生产任务投料
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:protask:add')")
+    @Log(title = "生产任务投料", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody ProTaskIssue proTaskIssue)
+    {
+        return toResponse(proTaskIssueService.insertProTaskIssue(proTaskIssue));
+    }
+
+    /**
+     * 修改生产任务投料
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:protask:edit')")
+    @Log(title = "生产任务投料", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody ProTaskIssue proTaskIssue)
+    {
+        return toResponse(proTaskIssueService.updateProTaskIssue(proTaskIssue));
+    }
+
+    /**
+     * 删除生产任务投料
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:protask:remove')")
+    @Log(title = "生产任务投料", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{recordIds}")
+    public Response remove(@PathVariable Long[] recordIds)
+    {
+        return toResponse(proTaskIssueService.deleteProTaskIssueByRecordIds(recordIds));
+    }
+}

+ 103 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/ProTransConsumeController.java

@@ -0,0 +1,103 @@
+package com.miaxis.mes.controller.pro;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.pro.domain.ProTransConsume;
+import com.miaxis.mes.pro.service.IProTransConsumeService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 物料消耗记录Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-07-24
+ */
+@RestController
+@RequestMapping("/mes/pro/transconsume")
+public class ProTransConsumeController extends BaseController
+{
+    @Autowired
+    private IProTransConsumeService proTransConsumeService;
+
+    /**
+     * 查询物料消耗记录列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(ProTransConsume proTransConsume)
+    {
+        startPage();
+        List<ProTransConsume> list = proTransConsumeService.selectProTransConsumeList(proTransConsume);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出物料消耗记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:transconsume:export')")
+    @Log(title = "物料消耗记录", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, ProTransConsume proTransConsume)
+    {
+        List<ProTransConsume> list = proTransConsumeService.selectProTransConsumeList(proTransConsume);
+        ExcelUtil<ProTransConsume> util = new ExcelUtil<ProTransConsume>(ProTransConsume.class);
+        return util.exportExcel( list, "物料消耗记录数据");
+    }
+
+    /**
+     * 获取物料消耗记录详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:transconsume:query')")
+    @GetMapping(value = "/{recordId}")
+    public Response getInfo(@PathVariable("recordId") Long recordId)
+    {
+        return Response.success(proTransConsumeService.selectProTransConsumeByRecordId(recordId));
+    }
+
+    /**
+     * 新增物料消耗记录
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:transconsume:add')")
+    @Log(title = "物料消耗记录", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody ProTransConsume proTransConsume)
+    {
+        return toResponse(proTransConsumeService.insertProTransConsume(proTransConsume));
+    }
+
+    /**
+     * 修改物料消耗记录
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:transconsume:edit')")
+    @Log(title = "物料消耗记录", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody ProTransConsume proTransConsume)
+    {
+        return toResponse(proTransConsumeService.updateProTransConsume(proTransConsume));
+    }
+
+    /**
+     * 删除物料消耗记录
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:transconsume:remove')")
+    @Log(title = "物料消耗记录", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{recordIds}")
+    public Response remove(@PathVariable Long[] recordIds)
+    {
+        return toResponse(proTransConsumeService.deleteProTransConsumeByRecordIds(recordIds));
+    }
+}

+ 112 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/ProTransOrderController.java

@@ -0,0 +1,112 @@
+package com.miaxis.mes.controller.pro;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.mes.wm.utils.WmBarCodeUtil;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.pro.domain.ProTransOrder;
+import com.miaxis.mes.pro.service.IProTransOrderService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 流转单Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-07-24
+ */
+@RestController
+@RequestMapping("/mes/pro/transorder")
+public class ProTransOrderController extends BaseController
+{
+    @Autowired
+    private IProTransOrderService proTransOrderService;
+
+    @Autowired
+    private WmBarCodeUtil wmBarCodeUtil;
+
+    /**
+     * 查询流转单列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(ProTransOrder proTransOrder)
+    {
+        startPage();
+        List<ProTransOrder> list = proTransOrderService.selectProTransOrderList(proTransOrder);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出流转单列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:transorder:export')")
+    @Log(title = "流转单", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, ProTransOrder proTransOrder)
+    {
+        List<ProTransOrder> list = proTransOrderService.selectProTransOrderList(proTransOrder);
+        ExcelUtil<ProTransOrder> util = new ExcelUtil<ProTransOrder>(ProTransOrder.class);
+        return util.exportExcel( list, "流转单数据");
+    }
+
+    /**
+     * 获取流转单详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:transorder:query')")
+    @GetMapping(value = "/{transOrderId}")
+    public Response getInfo(@PathVariable("transOrderId") Long transOrderId)
+    {
+        return Response.success(proTransOrderService.selectProTransOrderByTransOrderId(transOrderId));
+    }
+
+    /**
+     * 新增流转单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:transorder:add')")
+    @Log(title = "流转单", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody ProTransOrder proTransOrder)
+    {
+        proTransOrderService.insertProTransOrder(proTransOrder);
+        wmBarCodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_TRANSORDER,proTransOrder.getTransOrderId(),proTransOrder.getTransOrderCode(),null);
+        proTransOrder.setCreateBy(getUsername());
+        return Response.success(proTransOrder.getTransOrderId());
+    }
+
+    /**
+     * 修改流转单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:transorder:edit')")
+    @Log(title = "流转单", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody ProTransOrder proTransOrder)
+    {
+        return toResponse(proTransOrderService.updateProTransOrder(proTransOrder));
+    }
+
+    /**
+     * 删除流转单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:transorder:remove')")
+    @Log(title = "流转单", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{transOrderIds}")
+    public Response remove(@PathVariable Long[] transOrderIds)
+    {
+        return toResponse(proTransOrderService.deleteProTransOrderByTransOrderIds(transOrderIds));
+    }
+}

+ 103 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/ProWorkorderBomController.java

@@ -0,0 +1,103 @@
+package com.miaxis.mes.controller.pro;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.pro.domain.ProWorkorderBom;
+import com.miaxis.mes.pro.service.IProWorkorderBomService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 生产工单BOM组成Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-09
+ */
+@RestController
+@RequestMapping("/mes/pro/workorderbom")
+public class ProWorkorderBomController extends BaseController
+{
+    @Autowired
+    private IProWorkorderBomService proWorkorderBomService;
+
+    /**
+     * 查询生产工单BOM组成列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(ProWorkorderBom proWorkorderBom)
+    {
+        startPage();
+        List<ProWorkorderBom> list = proWorkorderBomService.selectProWorkorderBomList(proWorkorderBom);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出生产工单BOM组成列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:workorder:export')")
+    @Log(title = "生产工单BOM组成", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, ProWorkorderBom proWorkorderBom)
+    {
+        List<ProWorkorderBom> list = proWorkorderBomService.selectProWorkorderBomList(proWorkorderBom);
+        ExcelUtil<ProWorkorderBom> util = new ExcelUtil<ProWorkorderBom>(ProWorkorderBom.class);
+        return util.exportExcel( list, "生产工单BOM组成数据");
+    }
+
+    /**
+     * 获取生产工单BOM组成详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:workorder:query')")
+    @GetMapping(value = "/{lineId}")
+    public Response getInfo(@PathVariable("lineId") Long lineId)
+    {
+        return Response.success(proWorkorderBomService.selectProWorkorderBomByLineId(lineId));
+    }
+
+    /**
+     * 新增生产工单BOM组成
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:workorder:add')")
+    @Log(title = "生产工单BOM组成", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody ProWorkorderBom proWorkorderBom)
+    {
+        return toResponse(proWorkorderBomService.insertProWorkorderBom(proWorkorderBom));
+    }
+
+    /**
+     * 修改生产工单BOM组成
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:workorder:edit')")
+    @Log(title = "生产工单BOM组成", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody ProWorkorderBom proWorkorderBom)
+    {
+        return toResponse(proWorkorderBomService.updateProWorkorderBom(proWorkorderBom));
+    }
+
+    /**
+     * 删除生产工单BOM组成
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:workorder:remove')")
+    @Log(title = "生产工单BOM组成", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{lineIds}")
+    public Response remove(@PathVariable Long[] lineIds)
+    {
+        return toResponse(proWorkorderBomService.deleteProWorkorderBomByLineIds(lineIds));
+    }
+}

+ 265 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/ProWorkorderController.java

@@ -0,0 +1,265 @@
+package com.miaxis.mes.controller.pro;
+
+import cn.hutool.core.collection.CollUtil;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.md.domain.MdProductBom;
+import com.miaxis.mes.md.service.IMdProductBomService;
+import com.miaxis.mes.pro.domain.ProTask;
+import com.miaxis.mes.pro.domain.ProWorkorder;
+import com.miaxis.mes.pro.domain.ProWorkorderBom;
+import com.miaxis.mes.pro.service.IProTaskService;
+import com.miaxis.mes.pro.service.IProWorkorderBomService;
+import com.miaxis.mes.pro.service.IProWorkorderService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 生产工单Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-09
+ */
+@RestController
+@RequestMapping("/mes/pro/workorder")
+public class ProWorkorderController extends BaseController
+{
+    @Autowired
+    private IProWorkorderService proWorkorderService;
+
+    @Autowired
+    private IProWorkorderBomService proWorkorderBomService;
+
+    @Autowired
+    private IMdProductBomService mdProductBomService;
+
+    @Autowired
+    private IProTaskService proTaskService;
+
+    /**
+     * 查询生产工单列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(ProWorkorder proWorkorder)
+    {
+        startPage();
+        List<ProWorkorder> list = proWorkorderService.selectProWorkorderList(proWorkorder);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出生产工单列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:workorder:export')")
+    @Log(title = "生产工单", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, ProWorkorder proWorkorder)
+    {
+        List<ProWorkorder> list = proWorkorderService.selectProWorkorderList(proWorkorder);
+        ExcelUtil<ProWorkorder> util = new ExcelUtil<ProWorkorder>(ProWorkorder.class);
+        return util.exportExcel( list, "生产工单数据");
+    }
+
+    /**
+     * 获取生产工单详细信息
+     */
+    @GetMapping(value = "/{workorderId}")
+    public Response getInfo(@PathVariable("workorderId") Long workorderId)
+    {
+        return Response.success(proWorkorderService.selectProWorkorderByWorkorderId(workorderId));
+    }
+
+    /**
+     * 新增生产工单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:workorder:add')")
+    @Log(title = "生产工单", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody ProWorkorder proWorkorder)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(proWorkorderService.checkWorkorderCodeUnique(proWorkorder))){
+            throw new CustomException("生产工单编号已存在!");
+        }
+
+        if(proWorkorder.getParentId()==null || proWorkorder.getParentId()==0){
+            proWorkorder.setAncestors("0");
+        }
+        proWorkorderService.insertProWorkorder(proWorkorder);
+
+        Long workorderId = proWorkorder.getWorkorderId();
+        generateBomLine(workorderId);
+        proWorkorder.setCreateBy(getUsername());
+        return Response.success(workorderId);
+    }
+
+    /**
+     * 修改生产工单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:workorder:edit')")
+    @Log(title = "生产工单", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody ProWorkorder proWorkorder)
+    {
+        ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(proWorkorder.getWorkorderId());
+        int ret =proWorkorderService.updateProWorkorder(proWorkorder);
+        //如果是产品和数量发生变化则需要重新生成BOM组成
+        if(ret >0){
+            if(workorder.getProductId().longValue() != proWorkorder.getProductId().longValue() ||
+                    workorder.getQuantity().compareTo(proWorkorder.getQuantity())!=0){
+                removeBomLine(proWorkorder.getWorkorderId());
+                generateBomLine(proWorkorder.getWorkorderId());
+            }
+        }
+        return toResponse(ret);
+    }
+
+    /**
+     * 删除生产工单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:workorder:remove')")
+    @Log(title = "生产工单", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{workorderIds}")
+    public Response remove(@PathVariable Long[] workorderIds)
+    {
+        for (Long id:workorderIds
+             ) {
+            ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(id);
+            if(!UserConstants.ORDER_STATUS_PREPARE.equals(workorder.getStatus())){
+                throw new CustomException("只能删除草稿状态单据!");
+            }
+            removeBomLine(id);
+        }
+        return toResponse(proWorkorderService.deleteProWorkorderByWorkorderIds(workorderIds));
+    }
+
+    /**
+     * 根据生产工单中的产品生成BOM物料行
+     * @param workorderId
+     */
+    private void generateBomLine(Long workorderId){
+        //先根据ID找到对应的产品
+        ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(workorderId);
+
+        //根据产品找到BOM组成
+        MdProductBom param = new MdProductBom();
+        param.setItemId(workorder.getProductId());
+        List<MdProductBom> boms = mdProductBomService.selectMdProductBomList(param);
+
+        //生成BOM数据
+        BigDecimal orderQuantitiy = workorder.getQuantity();
+        ProWorkorderBom workorderBom = new ProWorkorderBom();
+        if(CollUtil.isNotEmpty(boms)){
+            for (MdProductBom bom:boms
+                 ) {
+                workorderBom.setWorkorderId(workorderId);
+                workorderBom.setItemId(bom.getBomItemId());
+                workorderBom.setItemCode(bom.getBomItemCode());
+                workorderBom.setItemName(bom.getBomItemName());
+                workorderBom.setItemSpc(bom.getBomItemSpec());
+                workorderBom.setItemOrProduct(bom.getItemOrProduct());
+                workorderBom.setUnitOfMeasure(bom.getUnitOfMeasure());
+                workorderBom.setQuantity(orderQuantitiy.multiply(bom.getQuantity()));
+                proWorkorderBomService.insertProWorkorderBom(workorderBom);
+            }
+        }
+    }
+
+    /**
+     * 删除当前工单下所有BOM组成
+     * @param workorderId
+     */
+    private void removeBomLine(Long workorderId){
+        ProWorkorderBom param = new ProWorkorderBom();
+        param.setWorkorderId(workorderId);
+        proWorkorderBomService.deleteProWorkorderBomByWorkorderId(workorderId);
+    }
+
+    /**
+     * 获取当前工单的物料需求清单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:workorder:list')")
+    @GetMapping("/listItems")
+    public ResponsePageInfo listItemss(ProWorkorder proWorkorder)
+    {
+        List<MdProductBom> result = new ArrayList<MdProductBom>();
+        ProWorkorderBom param = new ProWorkorderBom();
+        param.setWorkorderId(proWorkorder.getWorkorderId());
+        List<ProWorkorderBom> boms = proWorkorderBomService.selectProWorkorderBomList(param);
+        if(!CollectionUtils.isEmpty(boms)){
+            for ( ProWorkorderBom bom: boms
+                 ) {
+                MdProductBom theBom = new MdProductBom();
+                theBom.setBomItemId(bom.getItemId());
+                result.addAll(getBoms(theBom,bom.getQuantity(),0));
+            }
+        }
+        return toResponsePageInfo(result);
+    }
+
+    private List<MdProductBom> getBoms(MdProductBom item,BigDecimal quantity,int count){
+        MdProductBom param = new MdProductBom();
+        List<MdProductBom> results = new ArrayList<MdProductBom>();
+        if(count >20){
+            return results;
+        }
+        param.setItemId(item.getBomItemId());
+        List<MdProductBom> boms = mdProductBomService.selectMdProductBomList(param);
+        if(CollUtil.isNotEmpty(boms)){
+            //最多20层依赖
+            count ++;
+            for (MdProductBom bomItem: boms
+                 ) {
+                bomItem.setQuantity(quantity.multiply(bomItem.getQuantity()));
+                results.addAll(getBoms(bomItem,bomItem.getQuantity(),count));
+            }
+        }else{
+            results.add(item);
+        }
+        return results;
+    }
+
+
+    /**
+     * 完成工单
+     * @param workorderId
+     * @return
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:workorder:edit')")
+    @Log(title = "生产工单", businessType = BusinessTypeEnum.UPDATE)
+    @Transactional
+    @PutMapping("/{workorderId}")
+    public Response dofinish(@PathVariable Long workorderId){
+        ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(workorderId);
+
+        //将此工单下所有的生产任务状态设置为已完成
+        ProTask param = new ProTask();
+        param.setWorkorderId(workorderId);
+        List<ProTask> tasks = proTaskService.selectProTaskList(param);
+        if(!CollectionUtils.isEmpty(tasks)){
+            for (ProTask task:tasks
+                 ) {
+                task.setStatus(UserConstants.ORDER_STATUS_FINISHED);
+                proTaskService.updateProTask(task);
+            }
+        }
+
+        workorder.setStatus(UserConstants.ORDER_STATUS_FINISHED); //更新工单的状态
+        proWorkorderService.updateProWorkorder(workorder);
+        return Response.success();
+    }
+
+}

+ 190 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/mobile/ProFeedBackMobController.java

@@ -0,0 +1,190 @@
+package com.miaxis.mes.controller.pro.mobile;
+
+import cn.hutool.core.collection.CollectionUtil;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.mes.md.domain.MdWorkstation;
+import com.miaxis.mes.md.service.IMdWorkstationService;
+import com.miaxis.mes.pro.domain.ProFeedback;
+import com.miaxis.mes.pro.domain.ProRouteProcess;
+import com.miaxis.mes.pro.service.IProFeedbackService;
+import com.miaxis.mes.pro.service.IProRouteProcessService;
+import com.miaxis.system.strategy.AutoCodeUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Api("生产报工")
+@RestController
+@RequestMapping("/mobile/pro/feedback")
+public class ProFeedBackMobController extends BaseController {
+
+    @Autowired
+    private IProFeedbackService proFeedbackService;
+
+    @Autowired
+    private IMdWorkstationService mdWorkstationService;
+
+    @Autowired
+    private IProRouteProcessService proRouteProcessService;
+
+    @Autowired
+    private AutoCodeUtil autoCodeUtil;
+
+    /**
+     * 新增生产报工记录
+     */
+    @ApiOperation("新增报工单接口")
+    @PreAuthorize("@ss.hasPermi('mes:pro:feedback:add')")
+    @Log(title = "生产报工记录", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody ProFeedback proFeedback)
+    {
+        MdWorkstation workstation = mdWorkstationService.selectMdWorkstationByWorkstationId(proFeedback.getWorkstationId());
+        if(StringUtils.isNotNull(workstation)){
+            proFeedback.setProcessId(workstation.getProcessId());
+            proFeedback.setProcessCode(workstation.getProcessCode());
+            proFeedback.setProcessName(workstation.getProcessName());
+        }else {
+            throw new CustomException("当前生产任务对应的工作站不存在!");
+        }
+
+        //检查对应的工艺路线和工序配置
+        if(StringUtils.isNotNull(proFeedback.getRouteId())&& StringUtils.isNotNull(proFeedback.getProcessId())){
+            ProRouteProcess param = new ProRouteProcess();
+            param.setRouteId(proFeedback.getRouteId());
+            param.setProcessId(proFeedback.getProcessId());
+            List<ProRouteProcess> processes = proRouteProcessService.selectProRouteProcessList(param);
+            if(CollectionUtil.isEmpty(processes)){
+                throw new CustomException("未找到生产任务对应的工艺工序配置!");
+            }
+        }else {
+            throw new CustomException("当前生产任务对应的工艺工序配置无效!");
+        }
+
+        //检查数量
+        if(UserConstants.YES.equals(proFeedback.getIsCheck())){
+            if(!StringUtils.isNotNull(proFeedback.getQuantityUncheck())){
+                throw new CustomException("当前工作站报工需要经过质检确认,请输入待检测数量!");
+            }
+        }else {
+            if(!StringUtils.isNotNull(proFeedback.getQuantityQualified()) || !StringUtils.isNotNull(proFeedback.getQuantityUnquanlified())){
+                throw new CustomException("请输入合格品和不良品数量!");
+            }
+        }
+        String feedbackCode = autoCodeUtil.genSerialCode(UserConstants.FEEDBACK_CODE,"");
+        proFeedback.setFeedbackCode(feedbackCode);
+        proFeedback.setCreateBy(getUsername());
+        proFeedbackService.insertProFeedback(proFeedback);
+        return Response.success(proFeedback);
+    }
+
+    /**
+     * 查询生产报工记录列表
+     */
+    @ApiOperation("查询报工单清单-全部")
+    @GetMapping("/list")
+    public ResponsePageInfo list(ProFeedback proFeedback)
+    {
+        List<ProFeedback> list = proFeedbackService.selectProFeedbackList(proFeedback);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 查询生产报工记录列表
+     */
+    @ApiOperation("查询报工单清单-未审批通过的")
+    @GetMapping("/listUnApproved")
+    public ResponsePageInfo listUnApproved(ProFeedback proFeedback)
+    {
+        List<ProFeedback> all = new ArrayList<ProFeedback>();
+        proFeedback.setStatus(UserConstants.ORDER_STATUS_PREPARE);
+        List<ProFeedback> list1 = proFeedbackService.selectProFeedbackList(proFeedback);
+        all.addAll(list1);
+        proFeedback.setStatus(UserConstants.ORDER_STATUS_APPROVING);
+        List<ProFeedback> list2 = proFeedbackService.selectProFeedbackList(proFeedback);
+        all.addAll(list2);
+        return toResponsePageInfo(all);
+    }
+
+
+    /**
+     * 查询生产报工记录列表
+     */
+    @ApiOperation("查询报工单清单-已审批通过的")
+    @GetMapping("/listApproved")
+    public ResponsePageInfo listApproved(ProFeedback proFeedback)
+    {
+        proFeedback.setStatus(UserConstants.ORDER_STATUS_FINISHED);
+        List<ProFeedback> list = proFeedbackService.selectProFeedbackList(proFeedback);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 修改生产报工记录
+     */
+    @ApiOperation("报工修改接口")
+    @PreAuthorize("@ss.hasPermi('mes:pro:feedback:edit')")
+    @Log(title = "生产报工记录", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody ProFeedback proFeedback)
+    {
+        MdWorkstation workstation = mdWorkstationService.selectMdWorkstationByWorkstationId(proFeedback.getWorkstationId());
+        if(StringUtils.isNotNull(workstation)){
+            proFeedback.setProcessId(workstation.getProcessId());
+            proFeedback.setProcessCode(workstation.getProcessCode());
+            proFeedback.setProcessName(workstation.getProcessName());
+        }else {
+            throw new CustomException("当前生产任务对应的工作站不存在!");
+        }
+
+        //检查对应的工艺路线和工序配置
+        if(StringUtils.isNotNull(proFeedback.getRouteId())&& StringUtils.isNotNull(proFeedback.getProcessId())){
+            ProRouteProcess param = new ProRouteProcess();
+            param.setRouteId(proFeedback.getRouteId());
+            param.setProcessId(proFeedback.getProcessId());
+            List<ProRouteProcess> processes = proRouteProcessService.selectProRouteProcessList(param);
+            if(CollectionUtil.isEmpty(processes)){
+                throw new CustomException("未找到生产任务对应的工艺工序配置!");
+            }
+        }else {
+            throw new CustomException("当前生产任务对应的工艺工序配置无效!");
+        }
+
+        //检查数量
+        if(UserConstants.YES.equals(proFeedback.getIsCheck())){
+            if(!StringUtils.isNotNull(proFeedback.getQuantityUncheck())){
+                throw new CustomException("当前工作站报工需要经过质检确认,请输入待检测数量!");
+            }
+        }else {
+            if(!StringUtils.isNotNull(proFeedback.getQuantityQualified()) || !StringUtils.isNotNull(proFeedback.getQuantityUnquanlified())){
+                throw new CustomException("请输入合格品和不良品数量!");
+            }
+        }
+
+        return toResponse(proFeedbackService.updateProFeedback(proFeedback));
+    }
+
+    /**
+     * 删除生产报工记录
+     */
+    @ApiOperation("删除报工单")
+    @PreAuthorize("@ss.hasPermi('mes:pro:feedback:remove')")
+    @Log(title = "生产报工记录", businessType = BusinessTypeEnum.DELETE)
+    @DeleteMapping("/{recordIds}")
+    public Response remove(@PathVariable Long[] recordIds)
+    {
+        return toResponse(proFeedbackService.deleteProFeedbackByRecordIds(recordIds));
+    }
+}

+ 49 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/mobile/ProProcessMobController.java

@@ -0,0 +1,49 @@
+package com.miaxis.mes.controller.pro.mobile;
+
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.mes.pro.domain.ProProcess;
+import com.miaxis.mes.pro.service.IProProcessService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/mobile/pro/process")
+public class ProProcessMobController extends BaseController {
+
+    @Autowired
+    private IProProcessService proProcessService;
+
+    @GetMapping("/getProcessList")
+    public Response getProcessList(){
+        ProProcess proProcess = new ProProcess();
+        proProcess.setEnableFlag(UserConstants.YES);
+        List<ProProcess> list = proProcessService.selectProProcessList(proProcess);
+        return Response.success(list);
+    }
+
+    /**
+     * 获取工序详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:process:query')")
+    @GetMapping(value = "/{processId}")
+    public Response getInfo(@PathVariable("processId") Long processId)
+    {
+        ProProcess p = proProcessService.selectProProcessByProcessId(processId);
+        if(StringUtils.isNotNull(p)){
+            return Response.success(p);
+        }else{
+            throw new CustomException("未查询到当前工序信息");
+        }
+
+    }
+}

+ 225 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/mobile/ProTaskIssueMobController.java

@@ -0,0 +1,225 @@
+package com.miaxis.mes.controller.pro.mobile;
+
+import cn.hutool.core.collection.CollUtil;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.mes.md.domain.MdProductSop;
+import com.miaxis.mes.md.service.IMdProductSopService;
+import com.miaxis.mes.pro.domain.ProTask;
+import com.miaxis.mes.pro.domain.ProTaskIssue;
+import com.miaxis.mes.pro.domain.ProTransOrder;
+import com.miaxis.mes.pro.service.IProTaskIssueService;
+import com.miaxis.mes.pro.service.IProTaskService;
+import com.miaxis.mes.pro.service.IProTransOrderService;
+import com.miaxis.mes.wm.domain.WmIssueHeader;
+import com.miaxis.mes.wm.domain.WmIssueLine;
+import com.miaxis.mes.wm.service.IWmIssueHeaderService;
+import com.miaxis.mes.wm.service.IWmIssueLineService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+@RestController
+@RequestMapping("/mobile/pro/taskissue")
+public class ProTaskIssueMobController extends BaseController {
+
+    @Autowired
+    private IProTaskIssueService proTaskIssueService;
+
+    @Autowired
+    private IProTaskService proTaskService;
+
+    @Autowired
+    private IProTransOrderService proTransOrderService;
+
+
+    @Autowired
+    private IWmIssueHeaderService wmIssueHeaderService;
+
+    @Autowired
+    private IWmIssueLineService wmIssueLineService;
+
+    @Autowired
+    private IMdProductSopService mdProductSopService;
+
+    /**
+     * 获取当前产品的SOP
+     * @param mdProdutSop
+     * @return
+     */
+    @GetMapping("getSopList")
+    public Response getSopList(MdProductSop mdProdutSop){
+        List<MdProductSop> list = mdProductSopService.selectMdProductSopList(mdProdutSop);
+        return Response.success(list);
+    }
+
+    /**
+     * 查询当前工作站、当前任务的投料清单
+     * 至少提供workstationId、taskId两个参数
+     */
+    ///@PreAuthorize("@ss.hasPermi('mes:pro:taskissue:list')")
+    @GetMapping("/getlist")
+    public Response getIssueList(ProTaskIssue proTaskIssue) {
+        List<ProTaskIssue> list = proTaskIssueService.selectProTaskIssueList(proTaskIssue);
+        return Response.success(list);
+    }
+
+    /**
+     * 查询当前工作站、当前任务可用的的领料清单
+     * 如果某个领料单是领出到当前工作站或者当前任务的,则可以查询到
+     */
+    @GetMapping("/getReserveIssueList")
+    public Response getReserveIssueList(ProTaskIssue proTaskIssue){
+        WmIssueHeader param = new WmIssueHeader();
+        //领料单上指定了工作站
+        if(StringUtils.isNotNull(proTaskIssue.getWorkstationId())){
+            param.setWorkstationId(proTaskIssue.getWorkstationId());
+        }
+
+        //领料单上指定了生产工单
+        if(StringUtils.isNotNull(proTaskIssue.getWorkorderId())){
+            param.setWorkorderId(proTaskIssue.getWorkorderId());
+        }
+
+        //领料单上指定了生产任务
+        if(StringUtils.isNotNull(proTaskIssue.getTaskId())){
+            param.setTaskId(proTaskIssue.getTaskId());
+        }
+
+        List<WmIssueHeader> issueList = wmIssueHeaderService.selectWmIssueHeaderList(param);
+
+        List<WmIssueLine> lines = new ArrayList<WmIssueLine>();
+        if(CollUtil.isNotEmpty(issueList)){
+            WmIssueLine p = new WmIssueLine();
+            for (WmIssueHeader header: issueList
+                 ) {
+                p.setIssueId(header.getIssueId());
+                lines.addAll(wmIssueLineService.selectWmIssueLineList(p));
+            }
+        }
+
+        return Response.success(lines);
+    }
+
+    /**
+     * 通过新增或者扫码的方式添加某个流转单或者领料单到当前工作站、当前任务的投料清单中
+     * 此接口只支持一次性添加一行物料。如果要添加整个领料单,则可在领料单上指定工作站和任务;或者使用addIssue接口
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:taskissue:add')")
+    @Log(title = "生产任务投料", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping("/add")
+    @ResponseBody
+    public Response add(ProTaskIssue proTaskIssue)
+    {
+        //前端至少会传递taskId、workstationId、sourceLineId、sourceDocType几个字段过来
+        ProTask task = proTaskService.selectProTaskByTaskId(proTaskIssue.getTaskId());
+        proTaskIssue.setWorkorderId(task.getWorkorderId());
+
+        //如果是领料单
+        if(UserConstants.TASK_ISSUE_DOC_TYPE_ISSUE.equals(proTaskIssue.getSourceDocType())){
+            WmIssueLine line = wmIssueLineService.selectWmIssueLineByLineId(proTaskIssue.getSourceLineId());
+            WmIssueHeader header = wmIssueHeaderService.selectWmIssueHeaderByIssueId(line.getIssueId());
+            proTaskIssue.setSourceDocId(line.getIssueId());//设置领料单ID
+            proTaskIssue.setSourceDocCode(header.getIssueCode());//设置领料单编号
+            proTaskIssue.setBatchCode(line.getBatchCode());
+            proTaskIssue.setItemId(line.getItemId());
+            proTaskIssue.setItemCode(line.getItemCode());
+            proTaskIssue.setItemName(line.getItemName());
+            proTaskIssue.setSpecification(line.getSpecification());
+            proTaskIssue.setUnitOfMeasure(line.getUnitOfMeasure());
+            proTaskIssue.setQuantityIssued(line.getQuantityIssued());
+        }else{
+            //如果是流转单
+            ProTransOrder transOrder = proTransOrderService.selectProTransOrderByTransOrderId(proTaskIssue.getSourceDocId());
+            proTaskIssue.setTaskId(transOrder.getTaskId());
+            proTaskIssue.setWorkorderId(transOrder.getWorkorderId());
+            proTaskIssue.setSourceDocCode(transOrder.getTransOrderCode());
+            proTaskIssue.setBatchCode(transOrder.getBatchCode());
+            proTaskIssue.setSourceLineId(transOrder.getTransOrderId());//这里直接使用头ID作为source_line_id,因为流转单不是头行结构
+            proTaskIssue.setItemId(transOrder.getItemId());
+            proTaskIssue.setItemCode(transOrder.getItemCode());
+            proTaskIssue.setItemName(transOrder.getItemName());
+            proTaskIssue.setUnitOfMeasure(transOrder.getUnitOfMeasure());
+            proTaskIssue.setQuantityIssued(transOrder.getQuantityTransfered());//流转单的流转数量作为投料数量
+        }
+        //不能重复添加
+        if(UserConstants.NOT_UNIQUE.equals(proTaskIssueService.checkUnique(proTaskIssue))){
+            throw new CustomException("物料已添加过");
+        }
+        return toResponse(proTaskIssueService.insertProTaskIssue(proTaskIssue));
+    }
+
+
+    /**
+     * 通过新增或者扫码的方式添加某个流转单或者领料单到当前工作站、当前任务的投料清单中
+     * 此接口专门用于一次性添加整个领料单的场景,传递的proTaskIssue参数需要source_doc_id为对应的领料单头ID
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:taskissue:add')")
+    @Log(title = "生产任务投料", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping("/addIssue")
+    public Response addIssue(@RequestBody ProTaskIssue proTaskIssue)
+    {
+        if(!UserConstants.TASK_ISSUE_DOC_TYPE_ISSUE.equals(proTaskIssue.getSourceDocType())){
+            throw new CustomException("请选择或扫描生产领料单!");//这里只支持添加整个领料单
+        }
+        Long issueId = proTaskIssue.getSourceDocId();
+
+        WmIssueLine param = new WmIssueLine();
+        param.setIssueId(issueId);
+        List<WmIssueLine> issueLines = wmIssueLineService.selectWmIssueLineList(param);
+
+        if(CollUtil.isEmpty(issueLines)){
+            throw new CustomException("领料单行为空");
+        }
+
+        for (WmIssueLine line: issueLines
+             ) {
+            ProTaskIssue taskIssue = new ProTaskIssue();
+            taskIssue.setTaskId(proTaskIssue.getTaskId());
+            taskIssue.setWorkstationId(proTaskIssue.getWorkstationId());
+            taskIssue.setWorkorderId(proTaskIssue.getWorkorderId());
+            taskIssue.setSourceDocType(UserConstants.TASK_ISSUE_DOC_TYPE_ISSUE);
+            taskIssue.setSourceDocId(issueId);
+            //taskIssue.setSourceDocCode(); //领料单编号先不设置,需要的时候关联查询即可
+            taskIssue.setBatchCode(line.getBatchCode());
+            taskIssue.setSourceLineId(line.getLineId());
+            taskIssue.setItemId(line.getItemId());
+            taskIssue.setItemCode(line.getItemCode());
+            taskIssue.setItemName(line.getItemName());
+            taskIssue.setSpecification(line.getSpecification());
+            taskIssue.setUnitOfMeasure(line.getUnitOfMeasure());
+            taskIssue.setQuantityIssued(line.getQuantityIssued());
+            //taskIssue.setQuantityAvailable(); //可用数量,如果需要则要实时计算
+            taskIssue.setQuantityUsed(new BigDecimal(0)); //新添加的都默认为0;添加后删除再次添加也是0;实际使用量应该根据流转单计算
+
+            //不能重复添加
+            if(UserConstants.NOT_UNIQUE.equals(proTaskIssueService.checkUnique(taskIssue))){
+                throw new CustomException("物料已添加过");
+            }
+            proTaskIssueService.insertProTaskIssue(taskIssue);
+        }
+
+        return Response.success();
+    }
+
+    /**
+     * 删除生产任务投料
+     */
+    @PreAuthorize("@ss.hasPermi('mes:pro:taskissue:remove')")
+    @Log(title = "生产任务投料", businessType = BusinessTypeEnum.DELETE)
+    @PostMapping("/{recordId}")
+    @ResponseBody
+    public Response remove(@PathVariable Long recordId)
+    {
+        return toResponse(proTaskIssueService.deleteProTaskIssueByRecordId(recordId));
+    }
+
+}

+ 123 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/mobile/ProTaskMobController.java

@@ -0,0 +1,123 @@
+package com.miaxis.mes.controller.pro.mobile;
+
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.md.domain.MdWorkstation;
+import com.miaxis.mes.md.service.IMdWorkstationService;
+import com.miaxis.mes.pro.domain.ProFeedback;
+import com.miaxis.mes.pro.domain.ProTask;
+import com.miaxis.mes.pro.domain.ProTaskIssue;
+import com.miaxis.mes.pro.service.IProFeedbackService;
+import com.miaxis.mes.pro.service.IProTaskIssueService;
+import com.miaxis.mes.pro.service.IProTaskService;
+import com.miaxis.mes.wm.service.IWmIssueHeaderService;
+import com.miaxis.mes.wm.service.IWmIssueLineService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Date;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Api
+@RestController
+@RequestMapping("/mobile/pro/protask")
+public class ProTaskMobController extends BaseController {
+
+    @Autowired
+    private IProTaskService proTaskService;
+
+    @Autowired
+    private IProFeedbackService proFeedbackService;
+
+    @Autowired
+    private IMdWorkstationService mdWorkstationService;
+
+    @Autowired
+    private IProTaskIssueService proTaskIssueService;
+
+    @Autowired
+    private IWmIssueHeaderService wmIssueHeaderService;
+
+    @Autowired
+    private IWmIssueLineService wmIssueLineService;
+
+
+    @GetMapping("/getlist")
+    public Response getIssueList(ProTaskIssue proTaskIssue) {
+        List<ProTaskIssue> list = proTaskIssueService.selectProTaskIssueList(proTaskIssue);
+        return Response.success(list);
+    }
+
+    /**
+     * 查询工作站的生产任务
+     */
+    @ApiOperation("查询状态未完成的生产任务接口")
+    @GetMapping("/getTaskList")
+    public ResponsePageInfo list(ProTask proTask)
+    {
+        List<ProTask> list = proTaskService.selectProTaskList(proTask);
+        List<ProTask> l = list.stream().filter(t ->!"FINISHED".equals(t.getStatus())).collect(Collectors.toList());
+        return toResponsePageInfo(l);
+    }
+
+
+    /**
+     * 获取生产任务详细信息
+     */
+    @ApiOperation("查询生产任务详情接口")
+    @PreAuthorize("@ss.hasPermi('mes:pro:protask:query')")
+    @GetMapping(value = "/{taskId}")
+    public Response getInfo(@PathVariable("taskId") Long taskId)
+    {
+        return Response.success(proTaskService.selectProTaskByTaskId(taskId));
+    }
+
+
+    /**
+     * 修改生产任务状态
+     */
+    @ApiOperation("修改生产任务状态接口")
+    @Log(title = "生产任务", businessType = BusinessTypeEnum.UPDATE)
+    @PostMapping("/change")
+    @ResponseBody
+    public Response changeStatus(ProTask proTask)
+    {
+        return toResponse(proTaskService.updateProTask(proTask));
+    }
+
+    @Log(title = "生产报工", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping("/feedback")
+    @ResponseBody
+    public Response feedBack( ProFeedback feedback){
+
+        ProTask task = proTaskService.selectProTaskByTaskId(feedback.getTaskId());
+        feedback.setTaskCode(task.getTaskCode());
+        feedback.setWorkorderId(task.getWorkorderId());
+        feedback.setWorkorderCode(task.getWorkorderCode());
+        feedback.setWorkorderName(task.getWorkorderName());
+        feedback.setQuantity(task.getQuantity());
+        feedback.setFeedbackTime(new Date());
+
+        if(feedback.getWorkstationId() == null){
+            feedback.setWorkstationId(task.getWorkstationId());
+        }
+
+        MdWorkstation workstation = mdWorkstationService.selectMdWorkstationByWorkstationId(feedback.getWorkstationId());
+        feedback.setWorkstationCode(workstation.getWorkstationCode());
+        feedback.setWorkstationName(workstation.getWorkstationName());
+
+        task.setQuantityProduced(task.getQuantityProduced().add(feedback.getQuantityFeedback()));
+        task.setQuantityQuanlify(task.getQuantityQuanlify().add(feedback.getQuantityQualified()));
+        task.setQuantityUnquanlify(task.getQuantityUnquanlify().add(feedback.getQuantityUnquanlified()));
+        proTaskService.updateProTask(task);
+        return toResponse(proFeedbackService.insertProFeedback(feedback));
+    }
+
+}

+ 148 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/pro/mobile/ProTransOrderMobController.java

@@ -0,0 +1,148 @@
+package com.miaxis.mes.controller.pro.mobile;
+
+import cn.hutool.core.collection.CollectionUtil;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.mes.pro.domain.ProTask;
+import com.miaxis.mes.pro.domain.ProTransOrder;
+import com.miaxis.mes.pro.service.IProTaskService;
+import com.miaxis.mes.pro.service.IProTransOrderService;
+import com.miaxis.mes.wm.domain.WmBarcode;
+import com.miaxis.mes.wm.service.IWmBarcodeService;
+import com.miaxis.system.strategy.AutoCodeUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@Api("流转单接口")
+@RestController
+@RequestMapping("/mobile/pro/transorder")
+public class ProTransOrderMobController extends BaseController {
+
+    @Autowired
+    private IProTransOrderService proTransOrderService;
+
+    @Autowired
+    private AutoCodeUtil autoCodeUtil;
+
+    @Autowired
+    private IProTaskService proTaskService;
+
+    @Autowired
+    private IWmBarcodeService wmBarcodeService;
+
+    @ApiOperation("获取流转单清单")
+    @GetMapping("/getList")
+    public Response getList(ProTransOrder proTransOrder){
+
+
+        return Response.success();
+    }
+
+    /**
+     * 获取流转单详细信息
+     */
+    @ApiOperation("流转单详情查询接口")
+    @PreAuthorize("@ss.hasPermi('mes:pro:transorder:query')")
+    @GetMapping("/getInfo")
+    public Response getInfo(ProTransOrder proTransOrder)
+    {
+        ProTransOrder order = null;
+        if(StringUtils.isNotNull(proTransOrder.getTransOrderId())){
+            order = proTransOrderService.selectProTransOrderByTransOrderId(proTransOrder.getTransOrderId());
+        }
+
+        if(StringUtils.isNotNull(proTransOrder.getTransOrderCode())){
+            ProTransOrder param = new ProTransOrder();
+            param.setTransOrderCode(proTransOrder.getTransOrderCode());
+            List<ProTransOrder> orders =proTransOrderService.selectProTransOrderList(param);
+            if(!CollectionUtil.isEmpty(orders)){
+                order = orders.get(0);
+            }
+        }
+
+        return Response.success(order);
+    }
+
+
+    /**
+     * 新增流转单
+     */
+    @ApiOperation("流转单新增接口")
+    @PreAuthorize("@ss.hasPermi('mes:pro:transorder:add')")
+    @Log(title = "流转单", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody ProTransOrder proTransOrder)
+    {
+        if(!StringUtils.isNotNull(proTransOrder.getTransOrderCode())){
+            String transOrderCdoe = autoCodeUtil.genSerialCode(UserConstants.TRANS_ORDER_CODE,"");
+            proTransOrder.setTransOrderCode(transOrderCdoe);
+        }
+
+        if(StringUtils.isNotNull(proTransOrder.getTaskId())){
+            ProTask task =proTaskService.selectProTaskByTaskId(proTransOrder.getTaskId());
+            proTransOrder.setTaskCode(task.getTaskCode());
+            proTransOrder.setWorkstationId(task.getWorkstationId());
+            proTransOrder.setWorkstationCode(task.getWorkstationCode());
+            proTransOrder.setWorkstationName(task.getWorkstationName());
+            proTransOrder.setProcessId(task.getProcessId());
+            proTransOrder.setProcessCode(task.getProcessCode());
+            proTransOrder.setProcessName(task.getProcessName());
+            proTransOrder.setWorkorderId(task.getWorkorderId());
+            proTransOrder.setWorkorderCode(task.getWorkorderCode());
+            proTransOrder.setWorkorderName(task.getWorkorderName());
+            //TODO:批次信息的获取
+            proTransOrder.setItemId(task.getItemId());
+            proTransOrder.setItemCode(task.getItemCode());
+            proTransOrder.setItemName(task.getItemName());
+            proTransOrder.setUnitOfMeasure(task.getUnitOfMeasure());
+            proTransOrder.setSpecification(task.getSpecification());
+        }else{
+            throw new CustomException("请提供生产任务数据");
+        }
+
+        if(StringUtils.isNotNull(proTransOrder.getQuantityTransfered())){
+            throw new CustomException("请填写报工数量");
+        }
+        proTransOrder.setCreateBy(getUsername());
+        proTransOrderService.insertProTransOrder(proTransOrder);
+
+        //自动生成条码
+        WmBarcode code = new WmBarcode();
+        code.setBarcodeType(UserConstants.BARCODE_TYPE_TRANSORDER);
+        code.setBarcodeContent("TRANSORDER-"+proTransOrder.getTransOrderCode());
+        code.setBarcodeFormart(UserConstants.QR_CODE);
+        code.setBussinessId(proTransOrder.getTransOrderId());
+        code.setBussinessCode(proTransOrder.getTransOrderCode());
+        code.setEnableFlag(UserConstants.YES);
+        String path =wmBarcodeService.generateBarcode(code);
+        code.setBarcodeUrl(path);
+        wmBarcodeService.updateWmBarcode(code);
+        proTransOrder.setBarCodeUrl(path);
+        proTransOrderService.updateProTransOrder(proTransOrder);
+
+        return Response.success(proTransOrder);
+    }
+
+    /**
+     * 修改流转单
+     */
+    @ApiOperation("流转单修改接口")
+    @PreAuthorize("@ss.hasPermi('mes:pro:transorder:edit')")
+    @Log(title = "流转单", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody ProTransOrder proTransOrder)
+    {
+        return toResponse(proTransOrderService.updateProTransOrder(proTransOrder));
+    }
+
+
+}

+ 110 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/QcDefectController.java

@@ -0,0 +1,110 @@
+package com.miaxis.mes.controller.qc;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.system.strategy.AutoCodeUtil;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.qc.domain.QcDefect;
+import com.miaxis.mes.qc.service.IQcDefectService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 常见缺陷Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-19
+ */
+@RestController
+@RequestMapping("/mes/qc/qcdefect")
+public class QcDefectController extends BaseController
+{
+    @Autowired
+    private IQcDefectService qcDefectService;
+
+    @Autowired
+    private AutoCodeUtil autoCodeUtil;
+
+    /**
+     * 查询常见缺陷列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(QcDefect qcDefect)
+    {
+        startPage();
+        List<QcDefect> list = qcDefectService.selectQcDefectList(qcDefect);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出常见缺陷列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:qcdefect:export')")
+    @Log(title = "常见缺陷", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, QcDefect qcDefect)
+    {
+        List<QcDefect> list = qcDefectService.selectQcDefectList(qcDefect);
+        ExcelUtil<QcDefect> util = new ExcelUtil<QcDefect>(QcDefect.class);
+        return util.exportExcel( list, "常见缺陷数据");
+    }
+
+    /**
+     * 获取常见缺陷详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:qcdefect:query')")
+    @GetMapping(value = "/{defectId}")
+    public Response getInfo(@PathVariable("defectId") Long defectId)
+    {
+        return Response.success(qcDefectService.selectQcDefectByDefectId(defectId));
+    }
+
+    /**
+     * 新增常见缺陷
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:qcdefect:add')")
+    @Log(title = "常见缺陷", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody QcDefect qcDefect)
+    {
+        qcDefect.setDefectCode(autoCodeUtil.genSerialCode(UserConstants.DEFECT_CODE,null));
+        return toResponse(qcDefectService.insertQcDefect(qcDefect));
+    }
+
+    /**
+     * 修改常见缺陷
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:qcdefect:edit')")
+    @Log(title = "常见缺陷", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody QcDefect qcDefect)
+    {
+        return toResponse(qcDefectService.updateQcDefect(qcDefect));
+    }
+
+    /**
+     * 删除常见缺陷
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:qcdefect:remove')")
+    @Log(title = "常见缺陷", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{defectIds}")
+    public Response remove(@PathVariable Long[] defectIds)
+    {
+        return toResponse(qcDefectService.deleteQcDefectByDefectIds(defectIds));
+    }
+}

+ 170 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/QcDefectRecordController.java

@@ -0,0 +1,170 @@
+package com.miaxis.mes.controller.qc;
+
+import cn.hutool.core.collection.CollUtil;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.qc.domain.QcDefectRecord;
+import com.miaxis.mes.qc.domain.ValidList;
+import com.miaxis.mes.qc.service.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 检验单缺陷记录Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-08-30
+ */
+@RestController
+@RequestMapping("/mes/qc/defectrecord")
+public class QcDefectRecordController extends BaseController
+{
+    @Autowired
+    private IQcDefectRecordService qcDefectRecordService;
+
+    @Autowired
+    private IQcIqcLineService qcIqcLineService;
+
+    @Autowired
+    private IQcIqcService qcIqcService;
+
+    @Autowired
+    private IQcIpqcLineService qcIpqcLineService;
+
+    @Autowired
+    private IQcIpqcService qcIpqcService;
+
+    @Autowired
+    private IQcOqcService qcOqcService;
+
+    @Autowired
+    private IQcOqcLineService qcOqcLineService;
+
+
+    /**
+     * 查询检验单缺陷记录列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(QcDefectRecord qcDefectRecord)
+    {
+        startPage();
+        List<QcDefectRecord> list = qcDefectRecordService.selectQcDefectRecordList(qcDefectRecord);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出检验单缺陷记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:defectrecord:export')")
+    @Log(title = "检验单缺陷记录", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, QcDefectRecord qcDefectRecord)
+    {
+        List<QcDefectRecord> list = qcDefectRecordService.selectQcDefectRecordList(qcDefectRecord);
+        ExcelUtil<QcDefectRecord> util = new ExcelUtil<QcDefectRecord>(QcDefectRecord.class);
+        return util.exportExcel( list, "检验单缺陷记录数据");
+    }
+
+    /**
+     * 获取检验单缺陷记录详细信息
+     */
+    @GetMapping(value = "/{recordId}")
+    public Response getInfo(@PathVariable("recordId") Long recordId)
+    {
+        return Response.success(qcDefectRecordService.selectQcDefectRecordByRecordId(recordId));
+    }
+
+    /**
+     * 新增检验单缺陷记录
+     */
+    @Log(title = "检验单缺陷记录", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody QcDefectRecord qcDefectRecord)
+    {
+        if(!StringUtils.isNotNull(qcDefectRecord.getDefectName())){
+            throw new CustomException("请填写缺陷内容");
+        }
+
+        if(!StringUtils.isNotNull(qcDefectRecord.getDefectLevel())){
+            throw new CustomException("请选择缺陷级别");
+        }
+
+        return toResponse(qcDefectRecordService.insertQcDefectRecord(qcDefectRecord));
+    }
+
+    /**
+     * 修改来料检验单缺陷记录
+     */
+    @Log(title = "检验单缺陷记录", businessType = BusinessTypeEnum.UPDATE)
+    @Transactional
+    @PutMapping
+    public Response updateList(@Validated @RequestBody ValidList<QcDefectRecord> defects){
+        Long qcId = -1L;
+        String qcType = "";
+        Long lineId = -1L;
+        if(CollUtil.isNotEmpty(defects)){
+            for (QcDefectRecord defect: defects
+            ) {
+                if(!StringUtils.isNotNull(defect.getDefectName())){
+                    throw new CustomException("请填写缺陷内容");
+                }
+
+                if(!StringUtils.isNotNull(defect.getDefectLevel())){
+                    throw new CustomException("请选择缺陷级别");
+                }
+
+                if(StringUtils.isNotNull(defect.getRecordId())){
+                    qcDefectRecordService.updateQcDefectRecord(defect);
+                }else {
+                    qcDefectRecordService.insertQcDefectRecord(defect);
+                }
+                qcId = defect.getQcId();
+                qcType = defect.getQcType();
+                lineId = defect.getLineId();
+            }
+
+            if(UserConstants.QC_TYPE_IQC.equals(qcType)){
+                //更新来料检验单行上的cr,maj,min数量
+                qcIqcLineService.updateCrMajMinQuantity(qcId,lineId);
+                //更新来料检验单头上的cr,maj,min数量和比例
+                qcIqcService.updateCrMajMinQuaAndRate(qcId);
+
+            }else if(UserConstants.QC_TYPE_IPQC.equals(qcType)){
+                //更新过程检验单行上的cr,maj,min数量
+                qcIpqcLineService.updateCrMajMinQuantity(qcId,lineId);
+                //更新过程检验单头上的cr,maj,min数量和比例
+                qcIpqcService.updateCrMajMinQuaAndRate(qcId);
+            }else {
+                //更新出货检验单行上的cr,maj,min数量
+                qcOqcLineService.updateCrMajMinQuantity(qcId,lineId);
+                //更新出货检验单头上的cr,maj,min数量和比例
+                qcOqcService.updateCrMajMinQuaAndRate(qcId);
+            }
+
+        }
+        return Response.success();
+    }
+
+    /**
+     * 删除检验单缺陷记录
+     */
+    @Log(title = "检验单缺陷记录", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{recordIds}")
+    public Response remove(@PathVariable Long[] recordIds)
+    {
+        return toResponse(qcDefectRecordService.deleteQcDefectRecordByRecordIds(recordIds));
+    }
+}

+ 111 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/QcIndexController.java

@@ -0,0 +1,111 @@
+package com.miaxis.mes.controller.qc;
+
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.qc.domain.QcIndex;
+import com.miaxis.mes.qc.service.IQcIndexService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 检测项Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-17
+ */
+@RestController
+@RequestMapping("/mes/qc/qcindex")
+public class QcIndexController extends BaseController
+{
+    @Autowired
+    private IQcIndexService qcIndexService;
+
+    /**
+     * 查询检测项列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(QcIndex qcIndex)
+    {
+        startPage();
+        List<QcIndex> list = qcIndexService.selectQcIndexList(qcIndex);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出检测项列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:qcindex:export')")
+    @Log(title = "检测项", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, QcIndex qcIndex)
+    {
+        List<QcIndex> list = qcIndexService.selectQcIndexList(qcIndex);
+        ExcelUtil<QcIndex> util = new ExcelUtil<QcIndex>(QcIndex.class);
+        return util.exportExcel( list, "检测项数据");
+    }
+
+    /**
+     * 获取检测项详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:qcindex:query')")
+    @GetMapping(value = "/{indexId}")
+    public Response getInfo(@PathVariable("indexId") Long indexId)
+    {
+        return Response.success(qcIndexService.selectQcIndexByIndexId(indexId));
+    }
+
+    /**
+     * 新增检测项
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:qcindex:add')")
+    @Log(title = "检测项", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody QcIndex qcIndex)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(qcIndexService.checkIndexCodeUnique(qcIndex))){
+            throw new CustomException("检测项编号已存在!");
+        }
+        if(UserConstants.NOT_UNIQUE.equals(qcIndexService.checkIndexNameUnique(qcIndex))){
+            throw new CustomException("检测项名称已存在!");
+        }
+        return toResponse(qcIndexService.insertQcIndex(qcIndex));
+    }
+
+    /**
+     * 修改检测项
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:qcindex:edit')")
+    @Log(title = "检测项", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody QcIndex qcIndex)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(qcIndexService.checkIndexCodeUnique(qcIndex))){
+            throw new CustomException("检测项编号已存在!");
+        }
+        if(UserConstants.NOT_UNIQUE.equals(qcIndexService.checkIndexNameUnique(qcIndex))){
+            throw new CustomException("检测项名称已存在!");
+        }
+        return toResponse(qcIndexService.updateQcIndex(qcIndex));
+    }
+
+    /**
+     * 删除检测项
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:qcindex:remove')")
+    @Log(title = "检测项", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{indexIds}")
+    public Response remove(@PathVariable Long[] indexIds)
+    {
+        return toResponse(qcIndexService.deleteQcIndexByIndexIds(indexIds));
+    }
+}

+ 269 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/QcIpqcController.java

@@ -0,0 +1,269 @@
+package com.miaxis.mes.controller.qc;
+
+import cn.hutool.core.collection.CollUtil;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.pro.domain.ProFeedback;
+import com.miaxis.mes.pro.domain.ProWorkorder;
+import com.miaxis.mes.pro.service.IProFeedbackService;
+import com.miaxis.mes.pro.service.IProWorkorderService;
+import com.miaxis.mes.qc.domain.*;
+import com.miaxis.mes.qc.service.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 过程检验单Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-08-29
+ */
+@RestController
+@RequestMapping("/mes/qc/ipqc")
+public class QcIpqcController extends BaseController
+{
+    @Autowired
+    private IQcIpqcService qcIpqcService;
+
+    @Autowired
+    private IProWorkorderService proWorkorderService;
+
+    @Autowired
+    private IQcTemplateIndexService qcTemplateIndexService;
+
+    @Autowired
+    private IQcTemplateService qcTemplateService;
+
+    @Autowired
+    private IQcIpqcLineService qcIpqcLineService;
+
+    @Autowired
+    private IQcDefectRecordService qcDefectRecordService;
+
+    @Autowired
+    private IProFeedbackService proFeedbackService;
+
+    /**
+     * 查询过程检验单列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:ipqc:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(QcIpqc qcIpqc)
+    {
+        startPage();
+        List<QcIpqc> list = qcIpqcService.selectQcIpqcList(qcIpqc);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出过程检验单列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:ipqc:export')")
+    @Log(title = "过程检验单", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, QcIpqc qcIpqc)
+    {
+        List<QcIpqc> list = qcIpqcService.selectQcIpqcList(qcIpqc);
+        ExcelUtil<QcIpqc> util = new ExcelUtil<QcIpqc>(QcIpqc.class);
+        return util.exportExcel( list, "过程检验单数据");
+    }
+
+    /**
+     * 获取过程检验单详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:ipqc:query')")
+    @GetMapping(value = "/{ipqcId}")
+    public Response getInfo(@PathVariable("ipqcId") Long ipqcId)
+    {
+        return Response.success(qcIpqcService.selectQcIpqcByIpqcId(ipqcId));
+    }
+
+    /**
+     * 新增过程检验单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:ipqc:add')")
+    @Log(title = "过程检验单", businessType = BusinessTypeEnum.INSERT)
+    @Transactional
+    @PostMapping
+    public Response add(@RequestBody QcIpqc qcIpqc)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(qcIpqcService.checkIpqcCodeUnique(qcIpqc))){
+            throw new CustomException("检测单编码已存在!");
+        }
+
+        //根据工单获取产品信息
+        ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(qcIpqc.getWorkorderId());
+        qcIpqc.setWorkorderId(workorder.getWorkorderId());
+        qcIpqc.setWorkorderCode(workorder.getWorkorderCode());
+        qcIpqc.setWorkorderName(workorder.getWorkorderName());
+        qcIpqc.setItemId(workorder.getProductId());
+        qcIpqc.setItemCode(workorder.getProductCode());
+        qcIpqc.setItemName(workorder.getProductName());
+        qcIpqc.setSpecification(workorder.getProductSpc());
+        qcIpqc.setUnitOfMeasure(workorder.getUnitOfMeasure());
+
+        //查询工序相关信息
+        List<QcIpqc> infos = qcIpqcService.getProcessInfo(qcIpqc);
+        if(!CollectionUtils.isEmpty(infos)&&infos.size() ==1){
+            qcIpqc.setProcessId(infos.get(0).getProcessId());
+            qcIpqc.setProcessCode(infos.get(0).getProcessCode());
+            qcIpqc.setProcessName(infos.get(0).getProcessName());
+        }
+
+        //根据产品和检测类型获取检测模板
+        QcTemplate param = new QcTemplate();
+        param.setQcTypes(qcIpqc.getIpqcType());
+        param.setItemId(workorder.getProductId());
+        QcTemplate template = qcTemplateService.selectQcTemplateByProductAndQcType(param);
+        if(StringUtils.isNotNull(template)){
+            qcIpqc.setTemplateId(template.getTemplateId());
+        }else{
+            throw new CustomException("当前工单生产的产品未配置此类型的检验模板!");
+        }
+
+        //先保存
+        qcIpqcService.insertQcIpqc(qcIpqc);
+
+        //生成行信息
+        generateLine(qcIpqc);
+
+        //将ID返回
+        Long ipqcId = qcIpqc.getIpqcId();
+        return Response.success(ipqcId);
+    }
+
+    /**
+     * 修改过程检验单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:ipqc:edit')")
+    @Log(title = "过程检验单", businessType = BusinessTypeEnum.UPDATE)
+    @Transactional
+    @PutMapping
+    public Response edit(@RequestBody QcIpqc qcIpqc)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(qcIpqcService.checkIpqcCodeUnique(qcIpqc))){
+            throw new CustomException("检测单编码已存在!");
+        }
+
+        //对合格品和不合格品数量进行检查
+
+
+        //根据工单获取产品信息
+        ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(qcIpqc.getWorkorderId());
+        qcIpqc.setWorkorderId(workorder.getWorkorderId());
+        qcIpqc.setWorkorderCode(workorder.getWorkorderCode());
+        qcIpqc.setWorkorderName(workorder.getWorkorderName());
+        qcIpqc.setItemId(workorder.getProductId());
+        qcIpqc.setItemCode(workorder.getProductCode());
+        qcIpqc.setItemName(workorder.getProductName());
+        qcIpqc.setSpecification(workorder.getProductSpc());
+        qcIpqc.setUnitOfMeasure(workorder.getUnitOfMeasure());
+
+        //查询工序相关信息
+        List<QcIpqc> infos = qcIpqcService.getProcessInfo(qcIpqc);
+        if(!CollectionUtils.isEmpty(infos)&&infos.size() ==1){
+            qcIpqc.setProcessId(infos.get(0).getProcessId());
+            qcIpqc.setProcessCode(infos.get(0).getProcessCode());
+            qcIpqc.setProcessName(infos.get(0).getProcessName());
+        }
+
+        //根据产品和检测类型获取检测模板
+        QcTemplate param = new QcTemplate();
+        param.setQcTypes(qcIpqc.getIpqcType());
+        param.setItemId(workorder.getProductId());
+        QcTemplate template = qcTemplateService.selectQcTemplateByProductAndQcType(param);
+        if(StringUtils.isNotNull(template)){
+            qcIpqc.setTemplateId(template.getTemplateId());
+        }else{
+            throw new CustomException("当前工单生产的产品未配置此类型的检验模板!");
+        }
+
+        //如果是完成单据则根据单据上的来源单据,更新对应的关联检验单信息
+        if(UserConstants.ORDER_STATUS_FINISHED.equals(qcIpqc.getStatus())){
+            if(StringUtils.isNotNull(qcIpqc.getSourceDocCode())){
+                //这里默认更新生产报工单的数据
+                ProFeedback feedback =  proFeedbackService.selectProFeedbackByRecordId(qcIpqc.getSourceDocId());
+                if(StringUtils.isNotNull(feedback)){
+                    feedback.setQuantityQualified(qcIpqc.getQuantityQualified());
+                    feedback.setQuantityUnquanlified(qcIpqc.getQuantityUnqualified());
+                    feedback.setQuantityUncheck(BigDecimal.ZERO);
+                    proFeedbackService.updateProFeedback(feedback);
+                }
+            }
+        }
+
+        return toResponse(qcIpqcService.updateQcIpqc(qcIpqc));
+    }
+
+    /**
+     * 删除过程检验单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:ipqc:remove')")
+    @Log(title = "过程检验单", businessType = BusinessTypeEnum.DELETE)
+    @Transactional
+	@DeleteMapping("/{ipqcIds}")
+    public Response remove(@PathVariable Long[] ipqcIds)
+    {
+        for (Long ipqcId: ipqcIds
+             ) {
+            QcIpqc ipqc = qcIpqcService.selectQcIpqcByIpqcId(ipqcId);
+            if(!UserConstants.ORDER_STATUS_PREPARE.equals(ipqc.getStatus())){
+                throw new CustomException("只能删除草稿状态的单据!");
+            }
+
+            qcIpqcLineService.deleteByIpqcId(ipqcId); //删除对应的行信息
+            QcDefectRecord p2 = new QcDefectRecord();
+            p2.setQcId(ipqcId);
+            p2.setQcType(UserConstants.QC_TYPE_IPQC);
+            qcDefectRecordService.deleteByQcIdAndType(p2);//删除对应的缺陷记录
+        }
+
+        return toResponse(qcIpqcService.deleteQcIpqcByIpqcIds(ipqcIds));
+    }
+
+
+    /**
+     * 根据头信息生成行信息
+     * @param iqc
+     */
+    private void generateLine(QcIpqc iqc){
+        QcTemplateIndex param = new QcTemplateIndex();
+        param.setTemplateId(iqc.getTemplateId());
+        List<QcTemplateIndex > indexs = qcTemplateIndexService.selectQcTemplateIndexList(param);
+        if(CollUtil.isNotEmpty(indexs)){
+            for (QcTemplateIndex index:indexs
+            ) {
+                QcIpqcLine line = new QcIpqcLine();
+                line.setIpqcId(iqc.getIpqcId());
+                line.setIndexId(index.getIndexId());
+                line.setIndexCode(index.getIndexCode());
+                line.setIndexName(index.getIndexName());
+                line.setIndexType(index.getIndexType());
+                line.setQcTool(index.getQcTool());
+                line.setCheckMethod(index.getCheckMethod());
+                line.setStanderVal(index.getStanderVal());
+                line.setUnitOfMeasure(index.getUnitOfMeasure());
+                line.setThresholdMax(index.getThresholdMax());
+                line.setThresholdMin(index.getThresholdMin());
+                line.setCrQuantity(new BigDecimal(0L));
+                line.setMajQuantity(new BigDecimal(0L));
+                line.setMajQuantity(new BigDecimal(0L));
+                qcIpqcLineService.insertQcIpqcLine(line);
+            }
+        }
+    }
+}

+ 98 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/QcIpqcLineController.java

@@ -0,0 +1,98 @@
+package com.miaxis.mes.controller.qc;
+
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.qc.domain.QcIpqcLine;
+import com.miaxis.mes.qc.service.IQcIpqcLineService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 过程检验单行Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-08-30
+ */
+@RestController
+@RequestMapping("/mes/qc/ipqcline")
+public class QcIpqcLineController extends BaseController
+{
+    @Autowired
+    private IQcIpqcLineService qcIpqcLineService;
+
+    /**
+     * 查询过程检验单行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:ipqc:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(QcIpqcLine qcIpqcLine)
+    {
+        startPage();
+        List<QcIpqcLine> list = qcIpqcLineService.selectQcIpqcLineList(qcIpqcLine);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出过程检验单行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:ipqc:export')")
+    @Log(title = "过程检验单行", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, QcIpqcLine qcIpqcLine)
+    {
+        List<QcIpqcLine> list = qcIpqcLineService.selectQcIpqcLineList(qcIpqcLine);
+        ExcelUtil<QcIpqcLine> util = new ExcelUtil<QcIpqcLine>(QcIpqcLine.class);
+        return util.exportExcel( list, "过程检验单行数据");
+    }
+
+    /**
+     * 获取过程检验单行详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:ipqc:query')")
+    @GetMapping(value = "/{lineId}")
+    public Response getInfo(@PathVariable("lineId") Long lineId)
+    {
+        return Response.success(qcIpqcLineService.selectQcIpqcLineByLineId(lineId));
+    }
+
+    /**
+     * 新增过程检验单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:ipqc:add')")
+    @Log(title = "过程检验单行", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody QcIpqcLine qcIpqcLine)
+    {
+        return toResponse(qcIpqcLineService.insertQcIpqcLine(qcIpqcLine));
+    }
+
+    /**
+     * 修改过程检验单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:ipqc:edit')")
+    @Log(title = "过程检验单行", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody QcIpqcLine qcIpqcLine)
+    {
+        return toResponse(qcIpqcLineService.updateQcIpqcLine(qcIpqcLine));
+    }
+
+    /**
+     * 删除过程检验单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:ipqc:remove')")
+    @Log(title = "过程检验单行", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{lineIds}")
+    public Response remove(@PathVariable Long[] lineIds)
+    {
+        return toResponse(qcIpqcLineService.deleteQcIpqcLineByLineIds(lineIds));
+    }
+}

+ 210 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/QcIqcController.java

@@ -0,0 +1,210 @@
+package com.miaxis.mes.controller.qc;
+
+import cn.hutool.core.collection.CollUtil;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.qc.domain.*;
+import com.miaxis.mes.qc.service.*;
+import com.miaxis.mes.wm.domain.WmItemRecptLine;
+import com.miaxis.mes.wm.service.IWmItemRecptLineService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 来料检验单Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-19
+ */
+@RestController
+@RequestMapping("/mes/qc/iqc")
+public class QcIqcController extends BaseController
+{
+    @Autowired
+    private IQcIqcService qcIqcService;
+
+    @Autowired
+    private IQcTemplateProductService qcTemplateProductService;
+
+    @Autowired
+    private IQcTemplateIndexService qcTemplateIndexService;
+
+    @Autowired
+    private IQcIqcLineService qcIqcLineService;
+
+    @Autowired
+    private IQcDefectRecordService qcDefectRecordService;
+
+    @Autowired
+    private IWmItemRecptLineService wmItemRecptLineService;
+
+
+    /**
+     * 查询来料检验单列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(QcIqc qcIqc)
+    {
+        startPage();
+        List<QcIqc> list = qcIqcService.selectQcIqcList(qcIqc);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出来料检验单列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:iqc:export')")
+    @Log(title = "来料检验单", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, QcIqc qcIqc)
+    {
+        List<QcIqc> list = qcIqcService.selectQcIqcList(qcIqc);
+        ExcelUtil<QcIqc> util = new ExcelUtil<QcIqc>(QcIqc.class);
+        return util.exportExcel( list, "来料检验单数据");
+    }
+
+    /**
+     * 获取来料检验单详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:iqc:query')")
+    @GetMapping(value = "/{iqcId}")
+    public Response getInfo(@PathVariable("iqcId") Long iqcId)
+    {
+        return Response.success(qcIqcService.selectQcIqcByIqcId(iqcId));
+    }
+
+    /**
+     * 新增来料检验单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:iqc:add')")
+    @Log(title = "来料检验单", businessType = BusinessTypeEnum.INSERT)
+    @Transactional
+    @PostMapping
+    public Response add(@RequestBody QcIqc qcIqc)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(qcIqcService.checkIqcCodeUnique(qcIqc))){
+            throw new CustomException("单据编号已存在!");
+        }
+
+        QcTemplateProduct param = new QcTemplateProduct();
+        param.setItemId(qcIqc.getItemId());
+        List<QcTemplateProduct> templates = qcTemplateProductService.selectQcTemplateProductList(param);
+        if(CollUtil.isNotEmpty(templates)){
+            qcIqc.setTemplateId(templates.get(0).getTemplateId());
+        }else{
+            throw new CustomException("当前产品未配置检测模板!");
+        }
+        qcIqc.setInspector(getUsername());
+        qcIqcService.insertQcIqc(qcIqc);
+        generateLine(qcIqc);
+        Long iqcId = qcIqc.getIqcId();
+        return Response.success(iqcId); //将生成的ID返回给页面
+    }
+
+    /**
+     * 修改来料检验单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:iqc:edit')")
+    @Log(title = "来料检验单", businessType = BusinessTypeEnum.UPDATE)
+    @Transactional
+    @PutMapping
+    public Response edit(@RequestBody QcIqc qcIqc)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(qcIqcService.checkIqcCodeUnique(qcIqc))){
+            throw new CustomException("单据编号已存在!");
+        }
+
+        QcTemplateProduct param = new QcTemplateProduct();
+        param.setItemId(qcIqc.getItemId());
+        List<QcTemplateProduct> templates = qcTemplateProductService.selectQcTemplateProductList(param);
+        if(CollUtil.isNotEmpty(templates)){
+            qcIqc.setTemplateId(templates.get(0).getTemplateId());
+        }else{
+            throw new CustomException("当前产品未配置检测模板!");
+        }
+        qcIqc.setInspector(getUsername());
+
+        //如果是完成状态,则根据来源单据更新其对应的检测单
+        if(UserConstants.ORDER_STATUS_FINISHED.equals(qcIqc.getStatus())){
+            if(StringUtils.isNotNull(qcIqc.getSourceDocCode())){
+                //这里默认是采购入库单,后续有其他单据则根据单据类型(sourceDocType)进行区分
+                WmItemRecptLine line = wmItemRecptLineService.selectWmItemRecptLineByLineId(qcIqc.getSourceLineId());
+                if(StringUtils.isNotNull(line)){
+                    line.setIqcCode(qcIqc.getIqcCode());
+                    line.setIqcId(qcIqc.getIqcId());
+                    wmItemRecptLineService.updateWmItemRecptLine(line);
+                }
+            }
+        }
+
+        return toResponse(qcIqcService.updateQcIqc(qcIqc));
+    }
+
+    /**
+     * 删除来料检验单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:iqc:remove')")
+    @Log(title = "来料检验单", businessType = BusinessTypeEnum.DELETE)
+    @Transactional
+	@DeleteMapping("/{iqcIds}")
+    public Response remove(@PathVariable Long[] iqcIds)
+    {
+        for (Long iqcId:iqcIds
+             ) {
+            QcIqc iqc = qcIqcService.selectQcIqcByIqcId(iqcId);
+            if(!UserConstants.ORDER_STATUS_PREPARE.equals(iqc.getStatus())){
+                throw new CustomException("只能删除草稿状态单据!");
+            }
+            qcIqcLineService.deleteByIqcId(iqcId);
+            QcDefectRecord p2 = new QcDefectRecord();
+            p2.setQcId(iqcId);
+            p2.setQcType(UserConstants.QC_TYPE_IQC);
+            qcDefectRecordService.deleteByQcIdAndType(p2);//删除对应的缺陷记录
+        }
+        return toResponse(qcIqcService.deleteQcIqcByIqcIds(iqcIds));
+    }
+
+    /**
+     * 根据头信息生成行信息
+     * @param iqc
+     */
+    private void generateLine(QcIqc iqc){
+        QcTemplateIndex param = new QcTemplateIndex();
+        param.setTemplateId(iqc.getTemplateId());
+        List<QcTemplateIndex > indexs = qcTemplateIndexService.selectQcTemplateIndexList(param);
+        if(CollUtil.isNotEmpty(indexs)){
+            for (QcTemplateIndex index:indexs
+                 ) {
+                QcIqcLine line = new QcIqcLine();
+                line.setIqcId(iqc.getIqcId());
+                line.setIndexId(index.getIndexId());
+                line.setIndexCode(index.getIndexCode());
+                line.setIndexName(index.getIndexName());
+                line.setIndexType(index.getIndexType());
+                line.setQcTool(index.getQcTool());
+                line.setCheckMethod(index.getCheckMethod());
+                line.setStanderVal(index.getStanderVal());
+                line.setUnitOfMeasure(index.getUnitOfMeasure());
+                line.setThresholdMax(index.getThresholdMax());
+                line.setThresholdMin(index.getThresholdMin());
+                line.setCrQuantity(0L);
+                line.setMajQuantity(0L);
+                line.setMajQuantity(0L);
+                qcIqcLineService.insertQcIqcLine(line);
+            }
+        }
+    }
+
+}

+ 104 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/QcIqcLineController.java

@@ -0,0 +1,104 @@
+package com.miaxis.mes.controller.qc;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.qc.domain.QcIqcLine;
+import com.miaxis.mes.qc.service.IQcIqcLineService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 来料检验单行Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-19
+ */
+@RestController
+@RequestMapping("/mes/qc/iqcline")
+public class QcIqcLineController extends BaseController
+{
+    @Autowired
+    private IQcIqcLineService qcIqcLineService;
+
+    /**
+     * 查询来料检验单行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:iqc:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(QcIqcLine qcIqcLine)
+    {
+        startPage();
+        List<QcIqcLine> list = qcIqcLineService.selectQcIqcLineList(qcIqcLine);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出来料检验单行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:iqc:export')")
+    @Log(title = "来料检验单行", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, QcIqcLine qcIqcLine)
+    {
+        List<QcIqcLine> list = qcIqcLineService.selectQcIqcLineList(qcIqcLine);
+        ExcelUtil<QcIqcLine> util = new ExcelUtil<QcIqcLine>(QcIqcLine.class);
+        return util.exportExcel( list, "来料检验单行数据");
+    }
+
+    /**
+     * 获取来料检验单行详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:iqc:query')")
+    @GetMapping(value = "/{lineId}")
+    public Response getInfo(@PathVariable("lineId") Long lineId)
+    {
+        return Response.success(qcIqcLineService.selectQcIqcLineByLineId(lineId));
+    }
+
+    /**
+     * 新增来料检验单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:iqc:add')")
+    @Log(title = "来料检验单行", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody QcIqcLine qcIqcLine)
+    {
+        return toResponse(qcIqcLineService.insertQcIqcLine(qcIqcLine));
+    }
+
+    /**
+     * 修改来料检验单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:iqc:edit')")
+    @Log(title = "来料检验单行", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody QcIqcLine qcIqcLine)
+    {
+        return toResponse(qcIqcLineService.updateQcIqcLine(qcIqcLine));
+    }
+
+    /**
+     * 删除来料检验单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:iqc:remove')")
+    @Log(title = "来料检验单行", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{lineIds}")
+    public Response remove(@PathVariable Long[] lineIds)
+    {
+        return toResponse(qcIqcLineService.deleteQcIqcLineByLineIds(lineIds));
+    }
+}

+ 210 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/QcOqcController.java

@@ -0,0 +1,210 @@
+package com.miaxis.mes.controller.qc;
+
+import cn.hutool.core.collection.CollUtil;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.qc.domain.QcOqc;
+import com.miaxis.mes.qc.domain.QcOqcLine;
+import com.miaxis.mes.qc.domain.QcTemplateIndex;
+import com.miaxis.mes.qc.domain.QcTemplateProduct;
+import com.miaxis.mes.qc.service.IQcOqcLineService;
+import com.miaxis.mes.qc.service.IQcOqcService;
+import com.miaxis.mes.qc.service.IQcTemplateIndexService;
+import com.miaxis.mes.qc.service.IQcTemplateProductService;
+import com.miaxis.mes.wm.domain.WmProductSalseLine;
+import com.miaxis.mes.wm.service.IWmProductSalseLineService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 出货检验单Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-08-31
+ */
+@RestController
+@RequestMapping("/mes/qc/oqc")
+public class QcOqcController extends BaseController
+{
+    @Autowired
+    private IQcOqcService qcOqcService;
+
+    @Autowired
+    private IQcOqcLineService qcOqcLineService;
+
+    @Autowired
+    private IQcTemplateProductService qcTemplateProductService;
+
+    @Autowired
+    private IQcTemplateIndexService qcTemplateIndexService;
+
+    @Autowired
+    private IWmProductSalseLineService wmProductSalseLineService;
+
+    /**
+     * 查询出货检验单列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(QcOqc qcOqc)
+    {
+        startPage();
+        List<QcOqc> list = qcOqcService.selectQcOqcList(qcOqc);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出出货检验单列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:oqc:export')")
+    @Log(title = "出货检验单", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, QcOqc qcOqc)
+    {
+        List<QcOqc> list = qcOqcService.selectQcOqcList(qcOqc);
+        ExcelUtil<QcOqc> util = new ExcelUtil<QcOqc>(QcOqc.class);
+        return util.exportExcel( list, "出货检验单数据");
+    }
+
+    /**
+     * 获取出货检验单详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:oqc:query')")
+    @GetMapping(value = "/{oqcId}")
+    public Response getInfo(@PathVariable("oqcId") Long oqcId)
+    {
+        return Response.success(qcOqcService.selectQcOqcByOqcId(oqcId));
+    }
+
+    /**
+     * 新增出货检验单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:oqc:add')")
+    @Log(title = "出货检验单", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody QcOqc qcOqc)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(qcOqcService.checkOqcCodeUnique(qcOqc))){
+            throw new CustomException("出货单编号已存在!");
+        }
+        //自动获取对应的检测模板
+        QcTemplateProduct param = new QcTemplateProduct();
+        param.setItemId(qcOqc.getItemId());
+        List<QcTemplateProduct> templates = qcTemplateProductService.selectQcTemplateProductList(param);
+        if(CollUtil.isNotEmpty(templates)){
+            qcOqc.setTemplateId(templates.get(0).getTemplateId());
+        }else{
+            throw new CustomException("当前产品未配置检测模板!");
+        }
+        //设置检测人
+        qcOqc.setInspector(getUsername());
+        //先保存单据
+        qcOqcService.insertQcOqc(qcOqc);
+        //生成行信息
+        generateLine(qcOqc);
+
+        Long oqcId = qcOqc.getOqcId();
+        return Response.success(oqcId);
+    }
+
+    /**
+     * 修改出货检验单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:oqc:edit')")
+    @Log(title = "出货检验单", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody QcOqc qcOqc)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(qcOqcService.checkOqcCodeUnique(qcOqc))){
+            throw new CustomException("出货单编号已存在!");
+        }
+
+        //自动获取对应的检测模板
+        QcTemplateProduct param = new QcTemplateProduct();
+        param.setItemId(qcOqc.getItemId());
+        List<QcTemplateProduct> templates = qcTemplateProductService.selectQcTemplateProductList(param);
+        if(CollUtil.isNotEmpty(templates)){
+            qcOqc.setTemplateId(templates.get(0).getTemplateId());
+        }else{
+            throw new CustomException("当前产品未配置检测模板!");
+        }
+        //设置检测人
+        qcOqc.setInspector(getUsername());
+
+        if(UserConstants.ORDER_STATUS_FINISHED.equals(qcOqc.getStatus())){
+            if(StringUtils.isNotNull(qcOqc.getSourceDocCode())){
+                WmProductSalseLine line =  wmProductSalseLineService.selectWmProductSalseLineByLineId(qcOqc.getSourceLineId());
+                if(StringUtils.isNotNull(line)){
+                    line.setOqcId(qcOqc.getOqcId());
+                    line.setOqcCode(qcOqc.getOqcCode());
+                    wmProductSalseLineService.updateWmProductSalseLine(line);
+                }
+            }
+        }
+        return toResponse(qcOqcService.updateQcOqc(qcOqc));
+    }
+
+    /**
+     * 删除出货检验单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:oqc:remove')")
+    @Log(title = "出货检验单", businessType = BusinessTypeEnum.DELETE)
+    @Transactional
+	@DeleteMapping("/{oqcIds}")
+    public Response remove(@PathVariable Long[] oqcIds)
+    {
+        for (Long oqcId: oqcIds
+             ) {
+            QcOqc oqc = qcOqcService.selectQcOqcByOqcId(oqcId);
+            if(!UserConstants.ORDER_STATUS_PREPARE.equals(oqc.getStatus())){
+                throw new CustomException("只能删除状态为草稿的单据!");
+            }
+            qcOqcLineService.deleteByOqcId(oqcId);
+        }
+
+        return toResponse(qcOqcService.deleteQcOqcByOqcIds(oqcIds));
+    }
+
+    /**
+     * 根据头信息生成行信息
+     * @param oqc
+     */
+    private void generateLine(QcOqc oqc){
+        QcTemplateIndex param = new QcTemplateIndex();
+        param.setTemplateId(oqc.getTemplateId());
+        List<QcTemplateIndex> indexs = qcTemplateIndexService.selectQcTemplateIndexList(param);
+        if(CollUtil.isNotEmpty(indexs)){
+            for (QcTemplateIndex index:indexs
+            ) {
+                QcOqcLine line = new QcOqcLine();
+                line.setOqcId(oqc.getOqcId());
+                line.setIndexId(index.getIndexId());
+                line.setIndexCode(index.getIndexCode());
+                line.setIndexName(index.getIndexName());
+                line.setIndexType(index.getIndexType());
+                line.setQcTool(index.getQcTool());
+                line.setCheckMethod(index.getCheckMethod());
+                line.setStanderVal(index.getStanderVal());
+                line.setUnitOfMeasure(index.getUnitOfMeasure());
+                line.setThresholdMax(index.getThresholdMax());
+                line.setThresholdMin(index.getThresholdMin());
+                line.setCrQuantity(new BigDecimal(0L));
+                line.setMajQuantity(new BigDecimal(0L));
+                line.setMajQuantity(new BigDecimal(0L));
+                qcOqcLineService.insertQcOqcLine(line);
+            }
+        }
+    }
+}

+ 98 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/QcOqcLineController.java

@@ -0,0 +1,98 @@
+package com.miaxis.mes.controller.qc;
+
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.qc.domain.QcOqcLine;
+import com.miaxis.mes.qc.service.IQcOqcLineService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 出货检验单行Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-09-01
+ */
+@RestController
+@RequestMapping("/mes/qc/oqcline")
+public class QcOqcLineController extends BaseController
+{
+    @Autowired
+    private IQcOqcLineService qcOqcLineService;
+
+    /**
+     * 查询出货检验单行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:oqc:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(QcOqcLine qcOqcLine)
+    {
+        startPage();
+        List<QcOqcLine> list = qcOqcLineService.selectQcOqcLineList(qcOqcLine);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出出货检验单行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:oqc:export')")
+    @Log(title = "出货检验单行", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, QcOqcLine qcOqcLine)
+    {
+        List<QcOqcLine> list = qcOqcLineService.selectQcOqcLineList(qcOqcLine);
+        ExcelUtil<QcOqcLine> util = new ExcelUtil<QcOqcLine>(QcOqcLine.class);
+        return util.exportExcel( list, "出货检验单行数据");
+    }
+
+    /**
+     * 获取出货检验单行详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:oqc:query')")
+    @GetMapping(value = "/{lineId}")
+    public Response getInfo(@PathVariable("lineId") Long lineId)
+    {
+        return Response.success(qcOqcLineService.selectQcOqcLineByLineId(lineId));
+    }
+
+    /**
+     * 新增出货检验单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:oqc:add')")
+    @Log(title = "出货检验单行", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody QcOqcLine qcOqcLine)
+    {
+        return toResponse(qcOqcLineService.insertQcOqcLine(qcOqcLine));
+    }
+
+    /**
+     * 修改出货检验单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:oqc:edit')")
+    @Log(title = "出货检验单行", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody QcOqcLine qcOqcLine)
+    {
+        return toResponse(qcOqcLineService.updateQcOqcLine(qcOqcLine));
+    }
+
+    /**
+     * 删除出货检验单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:oqc:remove')")
+    @Log(title = "出货检验单行", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{lineIds}")
+    public Response remove(@PathVariable Long[] lineIds)
+    {
+        return toResponse(qcOqcLineService.deleteQcOqcLineByLineIds(lineIds));
+    }
+}

+ 34 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/QcPendingInspectController.java

@@ -0,0 +1,34 @@
+package com.miaxis.mes.controller.qc;
+
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.mes.qc.domain.QcPendingInspect;
+import com.miaxis.mes.qc.service.IQcPendingInspectService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/mes/qc/pending")
+public class QcPendingInspectController extends BaseController {
+
+    @Autowired
+    private IQcPendingInspectService qcPendingInspectService;
+
+
+    /**
+     * 获取待检验任务
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:pending:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(QcPendingInspect qcPendingInspect)
+    {
+        startPage();
+        List<QcPendingInspect> list = qcPendingInspectService.selectQcPendingList(qcPendingInspect);
+        return toResponsePageInfo(list);
+    }
+}

+ 165 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/QcTemplateController.java

@@ -0,0 +1,165 @@
+package com.miaxis.mes.controller.qc;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.ArrayUtil;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.qc.domain.QcTemplate;
+import com.miaxis.mes.qc.service.IQcTemplateIndexService;
+import com.miaxis.mes.qc.service.IQcTemplateProductService;
+import com.miaxis.mes.qc.service.IQcTemplateService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 检测模板Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-17
+ */
+@RestController
+@RequestMapping("/mes/qc/qctemplate")
+public class QcTemplateController extends BaseController
+{
+    @Autowired
+    private IQcTemplateService qcTemplateService;
+
+    @Autowired
+    private IQcTemplateIndexService qcTemplateIndexService;
+
+    @Autowired
+    private IQcTemplateProductService qcTemplateProductService;
+
+    /**
+     * 查询检测模板列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(QcTemplate qcTemplate)
+    {
+        startPage();
+        List<QcTemplate> list = qcTemplateService.selectQcTemplateList(qcTemplate);
+        if(CollUtil.isNotEmpty(list)){
+            for (int i=0;i<list.size();i++)
+            {
+                QcTemplate template = list.get(i);
+                template.setQcTypesParam(template.getQcTypes().split(","));
+                list.set(i,template);
+            }
+        }
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出检测模板列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:export')")
+    @Log(title = "检测模板", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, QcTemplate qcTemplate)
+    {
+        List<QcTemplate> list = qcTemplateService.selectQcTemplateList(qcTemplate);
+        ExcelUtil<QcTemplate> util = new ExcelUtil<QcTemplate>(QcTemplate.class);
+        return util.exportExcel( list, "检测模板数据");
+    }
+
+    /**
+     * 获取检测模板详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:query')")
+    @GetMapping(value = "/{templateId}")
+    public Response getInfo(@PathVariable("templateId") Long templateId)
+    {
+        QcTemplate template = qcTemplateService.selectQcTemplateByTemplateId(templateId);
+        if(StringUtils.isNotNull(template)){
+            template.setQcTypesParam(template.getQcTypes().split(","));
+        }
+        return Response.success(template);
+    }
+
+    /**
+     * 新增检测模板
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:add')")
+    @Log(title = "检测模板", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody QcTemplate qcTemplate)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(qcTemplateService.checkTemplateCodeUnique(qcTemplate))){
+            throw new CustomException("检测模板编号已存在!");
+        }
+
+        if(ArrayUtil.isNotEmpty(qcTemplate.getQcTypesParam())){
+            qcTemplate.setQcTypes(null); //先置空
+            String[] types = qcTemplate.getQcTypesParam();
+            //根据输入参数重新生成
+            for (String type:types
+                 ) {
+                if(StringUtils.isNotNull(qcTemplate.getQcTypes())){
+                    qcTemplate.setQcTypes(qcTemplate.getQcTypes()+','+type);
+                }else{
+                    qcTemplate.setQcTypes(type);
+                }
+            }
+        }
+
+        return toResponse(qcTemplateService.insertQcTemplate(qcTemplate));
+    }
+
+    /**
+     * 修改检测模板
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:edit')")
+    @Log(title = "检测模板", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody QcTemplate qcTemplate)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(qcTemplateService.checkTemplateCodeUnique(qcTemplate))){
+            throw new CustomException("检测模板编号已存在!");
+        }
+        if(ArrayUtil.isNotEmpty(qcTemplate.getQcTypesParam())){
+            qcTemplate.setQcTypes(null); //先置空
+            String[] types = qcTemplate.getQcTypesParam();
+            for (String type:types
+                    ) {
+                if(StringUtils.isNotNull(qcTemplate.getQcTypes())){
+                    qcTemplate.setQcTypes(qcTemplate.getQcTypes()+','+type);
+                }else{
+                    qcTemplate.setQcTypes(type);
+                }
+            }
+        }
+        return toResponse(qcTemplateService.updateQcTemplate(qcTemplate));
+    }
+
+    /**
+     * 删除检测模板
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:remove')")
+    @Log(title = "检测模板", businessType = BusinessTypeEnum.DELETE)
+    @Transactional
+	@DeleteMapping("/{templateIds}")
+    public Response remove(@PathVariable Long[] templateIds)
+    {
+
+        for (Long id:templateIds
+             ) {
+            //删除当前模板下所有检测项数据
+            qcTemplateIndexService.deleteByTemplateId(id);
+            //删除当前模板下所有检测产品
+            qcTemplateProductService.deleteByTemplateId(id);
+        }
+        return toResponse(qcTemplateService.deleteQcTemplateByTemplateIds(templateIds));
+    }
+}

+ 119 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/QcTemplateIndexController.java

@@ -0,0 +1,119 @@
+package com.miaxis.mes.controller.qc;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.miaxis.mes.qc.domain.QcIndex;
+import com.miaxis.mes.qc.service.IQcIndexService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.qc.domain.QcTemplateIndex;
+import com.miaxis.mes.qc.service.IQcTemplateIndexService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 检测模板-检测项Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-18
+ */
+@RestController
+@RequestMapping("/mes/qc/templateindex")
+public class QcTemplateIndexController extends BaseController
+{
+    @Autowired
+    private IQcTemplateIndexService qcTemplateIndexService;
+
+    @Autowired
+    private IQcIndexService qcIndexService;
+
+    /**
+     * 查询检测模板-检测项列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(QcTemplateIndex qcTemplateIndex)
+    {
+        startPage();
+        List<QcTemplateIndex> list = qcTemplateIndexService.selectQcTemplateIndexList(qcTemplateIndex);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出检测模板-检测项列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:export')")
+    @Log(title = "检测模板-检测项", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, QcTemplateIndex qcTemplateIndex)
+    {
+        List<QcTemplateIndex> list = qcTemplateIndexService.selectQcTemplateIndexList(qcTemplateIndex);
+        ExcelUtil<QcTemplateIndex> util = new ExcelUtil<QcTemplateIndex>(QcTemplateIndex.class);
+        return util.exportExcel( list, "检测模板-检测项数据");
+    }
+
+    /**
+     * 获取检测模板-检测项详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:query')")
+    @GetMapping(value = "/{recordId}")
+    public Response getInfo(@PathVariable("recordId") Long recordId)
+    {
+        return Response.success(qcTemplateIndexService.selectQcTemplateIndexByRecordId(recordId));
+    }
+
+    /**
+     * 新增检测模板-检测项
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:add')")
+    @Log(title = "检测模板-检测项", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody QcTemplateIndex qcTemplateIndex)
+    {
+        QcIndex index =qcIndexService.selectQcIndexByIndexId(qcTemplateIndex.getIndexId());
+        qcTemplateIndex.setIndexCode(index.getIndexCode());
+        qcTemplateIndex.setIndexName(index.getIndexName());
+        qcTemplateIndex.setIndexType(index.getIndexType());
+        qcTemplateIndex.setQcTool(index.getQcTool());
+        return toResponse(qcTemplateIndexService.insertQcTemplateIndex(qcTemplateIndex));
+    }
+
+    /**
+     * 修改检测模板-检测项
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:edit')")
+    @Log(title = "检测模板-检测项", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody QcTemplateIndex qcTemplateIndex)
+    {
+        QcIndex index =qcIndexService.selectQcIndexByIndexId(qcTemplateIndex.getIndexId());
+        qcTemplateIndex.setIndexCode(index.getIndexCode());
+        qcTemplateIndex.setIndexName(index.getIndexName());
+        qcTemplateIndex.setIndexType(index.getIndexType());
+        qcTemplateIndex.setQcTool(index.getQcTool());
+        return toResponse(qcTemplateIndexService.updateQcTemplateIndex(qcTemplateIndex));
+    }
+
+    /**
+     * 删除检测模板-检测项
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:remove')")
+    @Log(title = "检测模板-检测项", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{recordIds}")
+    public Response remove(@PathVariable Long[] recordIds)
+    {
+        return toResponse(qcTemplateIndexService.deleteQcTemplateIndexByRecordIds(recordIds));
+    }
+}

+ 105 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/QcTemplateProductController.java

@@ -0,0 +1,105 @@
+package com.miaxis.mes.controller.qc;
+
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.qc.domain.QcTemplateProduct;
+import com.miaxis.mes.qc.service.IQcTemplateProductService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 检测模板-产品Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-18
+ */
+@RestController
+@RequestMapping("/mes/qc/templateproduct")
+public class QcTemplateProductController extends BaseController
+{
+    @Autowired
+    private IQcTemplateProductService qcTemplateProductService;
+
+    /**
+     * 查询检测模板-产品列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(QcTemplateProduct qcTemplateProduct)
+    {
+        startPage();
+        List<QcTemplateProduct> list = qcTemplateProductService.selectQcTemplateProductList(qcTemplateProduct);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出检测模板-产品列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:export')")
+    @Log(title = "检测模板-产品", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, QcTemplateProduct qcTemplateProduct)
+    {
+        List<QcTemplateProduct> list = qcTemplateProductService.selectQcTemplateProductList(qcTemplateProduct);
+        ExcelUtil<QcTemplateProduct> util = new ExcelUtil<QcTemplateProduct>(QcTemplateProduct.class);
+        return util.exportExcel( list, "检测模板-产品数据");
+    }
+
+    /**
+     * 获取检测模板-产品详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:query')")
+    @GetMapping(value = "/{recordId}")
+    public Response getInfo(@PathVariable("recordId") Long recordId)
+    {
+        return Response.success(qcTemplateProductService.selectQcTemplateProductByRecordId(recordId));
+    }
+
+    /**
+     * 新增检测模板-产品
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:add')")
+    @Log(title = "检测模板-产品", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody QcTemplateProduct qcTemplateProduct)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(qcTemplateProductService.checkProductUnique(qcTemplateProduct))){
+            throw new CustomException("产品已设置检测模板!");
+        }
+        return toResponse(qcTemplateProductService.insertQcTemplateProduct(qcTemplateProduct));
+    }
+
+    /**
+     * 修改检测模板-产品
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:edit')")
+    @Log(title = "检测模板-产品", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody QcTemplateProduct qcTemplateProduct)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(qcTemplateProductService.checkProductUnique(qcTemplateProduct))){
+            throw new CustomException("产品已设置检测模板!");
+        }
+        return toResponse(qcTemplateProductService.updateQcTemplateProduct(qcTemplateProduct));
+    }
+
+    /**
+     * 删除检测模板-产品
+     */
+    @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:remove')")
+    @Log(title = "检测模板-产品", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{recordIds}")
+    public Response remove(@PathVariable Long[] recordIds)
+    {
+        return toResponse(qcTemplateProductService.deleteQcTemplateProductByRecordIds(recordIds));
+    }
+}

+ 47 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/qc/mobile/QcTemplateIndexMobController.java

@@ -0,0 +1,47 @@
+package com.miaxis.mes.controller.qc.mobile;
+
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.mes.qc.domain.QcMobParam;
+import com.miaxis.mes.qc.domain.QcTemplate;
+import com.miaxis.mes.qc.domain.QcTemplateIndex;
+import com.miaxis.mes.qc.service.IQcTemplateIndexService;
+import com.miaxis.mes.qc.service.IQcTemplateService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/mobile/qc/templateindex")
+public class QcTemplateIndexMobController {
+
+    @Autowired
+    private IQcTemplateService qcTemplateService;
+
+    @Autowired
+    private IQcTemplateIndexService qcTemplateIndexService;
+
+    /**
+     * 根据物料产品和质检类型查询对应的质检模板行信息
+     */
+    @GetMapping("/getLines")
+    public Response getLines(QcMobParam param){
+
+        //根据物料和质检类型查询模板
+        QcTemplate template = qcTemplateService.findTemplateByProductIdAndQcType(param);
+        if(StringUtils.isNull(template)){
+            throw new CustomException("当前生产的产品未配置此类型的检验模板,请联系质量管理人员!");
+        }
+
+        //根据模板查询模板行
+        QcTemplateIndex p = new QcTemplateIndex();
+        p.setTemplateId(template.getTemplateId());
+        List<QcTemplateIndex> indexList = qcTemplateIndexService.selectQcTemplateIndexList(p);
+        return Response.success(indexList);
+    }
+
+}

+ 98 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/report/UreportFileTblController.java

@@ -0,0 +1,98 @@
+package com.miaxis.mes.controller.report;
+
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.report.domain.UreportFileTbl;
+import com.miaxis.mes.report.service.IUreportFileTblService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 报表管理Controller
+ *
+ * @author yanshikui
+ * @date 2022-10-07
+ */
+@RestController
+@RequestMapping("/ureportM")
+public class UreportFileTblController extends BaseController
+{
+    @Autowired
+    private IUreportFileTblService ureportFileTblService;
+
+    /**
+     * 查询报表管理列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:report:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(UreportFileTbl ureportFileTbl)
+    {
+        startPage();
+        List<UreportFileTbl> list = ureportFileTblService.selectUreportFileTblList(ureportFileTbl);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出报表管理列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:report:export')")
+    @Log(title = "报表管理", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, UreportFileTbl ureportFileTbl)
+    {
+        List<UreportFileTbl> list = ureportFileTblService.selectUreportFileTblList(ureportFileTbl);
+        ExcelUtil<UreportFileTbl> util = new ExcelUtil<UreportFileTbl>(UreportFileTbl.class);
+        return util.exportExcel( list, "报表管理数据");
+    }
+
+    /**
+     * 获取报表管理详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:report:query')")
+    @GetMapping(value = "/{id}")
+    public Response getInfo(@PathVariable("id") Long id)
+    {
+        return Response.success(ureportFileTblService.selectUreportFileTblById(id));
+    }
+
+    /**
+     * 新增报表管理
+     */
+    @PreAuthorize("@ss.hasPermi('mes:report:add')")
+    @Log(title = "报表管理", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody UreportFileTbl ureportFileTbl)
+    {
+        return toResponse(ureportFileTblService.insertUreportFileTbl(ureportFileTbl));
+    }
+
+    /**
+     * 修改报表管理
+     */
+    @PreAuthorize("@ss.hasPermi('mes:report:edit')")
+    @Log(title = "报表管理", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody UreportFileTbl ureportFileTbl)
+    {
+        return toResponse(ureportFileTblService.updateUreportFileTbl(ureportFileTbl));
+    }
+
+    /**
+     * 删除报表管理
+     */
+    @PreAuthorize("@ss.hasPermi('mes:report:remove')")
+    @Log(title = "报表管理", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{ids}")
+    public Response remove(@PathVariable Long[] ids)
+    {
+        return toResponse(ureportFileTblService.deleteUreportFileTblByIds(ids));
+    }
+}

+ 130 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/tm/TmToolController.java

@@ -0,0 +1,130 @@
+package com.miaxis.mes.controller.tm;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.mes.tm.domain.TmToolType;
+import com.miaxis.mes.tm.service.ITmToolTypeService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.tm.domain.TmTool;
+import com.miaxis.mes.tm.service.ITmToolService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 工装夹具清单Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-11
+ */
+@RestController
+@RequestMapping("/mes/tm/tool")
+public class TmToolController extends BaseController
+{
+    @Autowired
+    private ITmToolService tmToolService;
+
+    @Autowired
+    private ITmToolTypeService tmToolTypeService;
+
+    /**
+     * 查询工装夹具清单列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(TmTool tmTool)
+    {
+        startPage();
+        List<TmTool> list = tmToolService.selectTmToolList(tmTool);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出工装夹具清单列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:tm:tool:export')")
+    @Log(title = "工装夹具清单", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, TmTool tmTool)
+    {
+        List<TmTool> list = tmToolService.selectTmToolList(tmTool);
+        ExcelUtil<TmTool> util = new ExcelUtil<TmTool>(TmTool.class);
+        return util.exportExcel( list, "工装夹具清单数据");
+    }
+
+    /**
+     * 获取工装夹具清单详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:tm:tool:query')")
+    @GetMapping(value = "/{toolId}")
+    public Response getInfo(@PathVariable("toolId") Long toolId)
+    {
+        return Response.success(tmToolService.selectTmToolByToolId(toolId));
+    }
+
+    /**
+     * 新增工装夹具清单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:tm:tool:add')")
+    @Log(title = "工装夹具清单", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody TmTool tmTool)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(tmToolService.checkToolCodeUnique(tmTool))){
+            throw new CustomException("此工装夹具编码已存在!");
+        }
+
+        TmToolType type = tmToolTypeService.selectTmToolTypeByToolTypeId(tmTool.getToolTypeId());
+        tmTool.setToolTypeCode(type.getToolTypeCode());
+        tmTool.setToolTypeName(type.getToolTypeName());
+        tmTool.setCodeFlag(type.getCodeFlag());
+        return toResponse(tmToolService.insertTmTool(tmTool));
+    }
+
+    /**
+     * 修改工装夹具清单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:tm:tool:edit')")
+    @Log(title = "工装夹具清单", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody TmTool tmTool)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(tmToolService.checkToolCodeUnique(tmTool))){
+            throw new CustomException("此工装夹具编码已存在!");
+        }
+        TmToolType type = tmToolTypeService.selectTmToolTypeByToolTypeId(tmTool.getToolTypeId());
+        tmTool.setToolTypeCode(type.getToolTypeCode());
+        tmTool.setToolTypeName(type.getToolTypeName());
+        tmTool.setCodeFlag(type.getCodeFlag());
+        if(UserConstants.MAINTEN_TYPE_REGULAR.equals(tmTool.getMaintenType())){
+            tmTool.setNextMaintenPeriod(null);
+        }else{
+            tmTool.setNextMaintenDate(null);
+        }
+        return toResponse(tmToolService.updateTmTool(tmTool));
+    }
+
+    /**
+     * 删除工装夹具清单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:tm:tool:remove')")
+    @Log(title = "工装夹具清单", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{toolIds}")
+    public Response remove(@PathVariable Long[] toolIds)
+    {
+        return toResponse(tmToolService.deleteTmToolByToolIds(toolIds));
+    }
+}

+ 125 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/tm/TmToolTypeController.java

@@ -0,0 +1,125 @@
+package com.miaxis.mes.controller.tm;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.miaxis.common.constant.UserConstants;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.tm.domain.TmToolType;
+import com.miaxis.mes.tm.service.ITmToolTypeService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 工装夹具类型Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-10
+ */
+@RestController
+@RequestMapping("/mes/tm/tooltype")
+public class TmToolTypeController extends BaseController
+{
+    @Autowired
+    private ITmToolTypeService tmToolTypeService;
+
+    /**
+     * 查询工装夹具类型列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(TmToolType tmToolType)
+    {
+        startPage();
+        List<TmToolType> list = tmToolTypeService.selectTmToolTypeList(tmToolType);
+        return toResponsePageInfo(list);
+    }
+
+    @GetMapping("/listAll")
+    public Response listAll(){
+        TmToolType tmToolType = new TmToolType();
+        List<TmToolType> list = tmToolTypeService.selectTmToolTypeList(tmToolType);
+        return Response.success(list);
+    }
+
+
+    /**
+     * 导出工装夹具类型列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:tm:tooltype:export')")
+    @Log(title = "工装夹具类型", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, TmToolType tmToolType)
+    {
+        List<TmToolType> list = tmToolTypeService.selectTmToolTypeList(tmToolType);
+        ExcelUtil<TmToolType> util = new ExcelUtil<TmToolType>(TmToolType.class);
+        return util.exportExcel( list, "工装夹具类型数据");
+    }
+
+    /**
+     * 获取工装夹具类型详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:tm:tooltype:query')")
+    @GetMapping(value = "/{toolTypeId}")
+    public Response getInfo(@PathVariable("toolTypeId") Long toolTypeId)
+    {
+        return Response.success(tmToolTypeService.selectTmToolTypeByToolTypeId(toolTypeId));
+    }
+
+    /**
+     * 新增工装夹具类型
+     */
+    @PreAuthorize("@ss.hasPermi('mes:tm:tooltype:add')")
+    @Log(title = "工装夹具类型", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody TmToolType tmToolType)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(tmToolTypeService.checkToolTypeCodeUnique(tmToolType))){
+            throw new CustomException("类型编码已存在!");
+        }
+        if(UserConstants.NOT_UNIQUE.equals(tmToolTypeService.checkToolTypeNameUnique(tmToolType))){
+            throw new CustomException("类型名称已存在!");
+        }
+        return toResponse(tmToolTypeService.insertTmToolType(tmToolType));
+    }
+
+    /**
+     * 修改工装夹具类型
+     */
+    @PreAuthorize("@ss.hasPermi('mes:tm:tooltype:edit')")
+    @Log(title = "工装夹具类型", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody TmToolType tmToolType)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(tmToolTypeService.checkToolTypeCodeUnique(tmToolType))){
+            throw new CustomException("类型编码已存在!");
+        }
+        if(UserConstants.NOT_UNIQUE.equals(tmToolTypeService.checkToolTypeNameUnique(tmToolType))){
+            throw new CustomException("类型名称已存在!");
+        }
+        return toResponse(tmToolTypeService.updateTmToolType(tmToolType));
+    }
+
+    /**
+     * 删除工装夹具类型
+     */
+    @PreAuthorize("@ss.hasPermi('mes:tm:tooltype:remove')")
+    @Log(title = "工装夹具类型", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{toolTypeIds}")
+    public Response remove(@PathVariable Long[] toolTypeIds)
+    {
+        return toResponse(tmToolTypeService.deleteTmToolTypeByToolTypeIds(toolTypeIds));
+    }
+}

+ 104 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmBarcodeConfigController.java

@@ -0,0 +1,104 @@
+package com.miaxis.mes.controller.wm;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.wm.domain.WmBarcodeConfig;
+import com.miaxis.mes.wm.service.IWmBarcodeConfigService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 条码配置Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-10-22
+ */
+@RestController
+@RequestMapping("/mes/wm/barcodeconfig")
+public class WmBarcodeConfigController extends BaseController
+{
+    @Autowired
+    private IWmBarcodeConfigService wmBarcodeConfigService;
+
+    /**
+     * 查询条码配置列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:barcodeconfig:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmBarcodeConfig wmBarcodeConfig)
+    {
+        startPage();
+        List<WmBarcodeConfig> list = wmBarcodeConfigService.selectWmBarcodeConfigList(wmBarcodeConfig);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出条码配置列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:barcodeconfig:export')")
+    @Log(title = "条码配置", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmBarcodeConfig wmBarcodeConfig)
+    {
+        List<WmBarcodeConfig> list = wmBarcodeConfigService.selectWmBarcodeConfigList(wmBarcodeConfig);
+        ExcelUtil<WmBarcodeConfig> util = new ExcelUtil<WmBarcodeConfig>(WmBarcodeConfig.class);
+        return util.exportExcel( list, "条码配置数据");
+    }
+
+    /**
+     * 获取条码配置详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:barcodeconfig:query')")
+    @GetMapping(value = "/{configId}")
+    public Response getInfo(@PathVariable("configId") Long configId)
+    {
+        return Response.success(wmBarcodeConfigService.selectWmBarcodeConfigByConfigId(configId));
+    }
+
+    /**
+     * 新增条码配置
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:barcodeconfig:add')")
+    @Log(title = "条码配置", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmBarcodeConfig wmBarcodeConfig)
+    {
+        return toResponse(wmBarcodeConfigService.insertWmBarcodeConfig(wmBarcodeConfig));
+    }
+
+    /**
+     * 修改条码配置
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:barcodeconfig:edit')")
+    @Log(title = "条码配置", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmBarcodeConfig wmBarcodeConfig)
+    {
+        return toResponse(wmBarcodeConfigService.updateWmBarcodeConfig(wmBarcodeConfig));
+    }
+
+    /**
+     * 删除条码配置
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:barcodeconfig:remove')")
+    @Log(title = "条码配置", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{configIds}")
+    public Response remove(@PathVariable Long[] configIds)
+    {
+        return toResponse(wmBarcodeConfigService.deleteWmBarcodeConfigByConfigIds(configIds));
+    }
+}

+ 109 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmBarcodeController.java

@@ -0,0 +1,109 @@
+package com.miaxis.mes.controller.wm;
+
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.wm.domain.WmBarcode;
+import com.miaxis.mes.wm.service.IWmBarcodeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 条码清单Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-08-01
+ */
+@RestController
+@RequestMapping("/mes/wm/barcode")
+public class WmBarcodeController extends BaseController
+{
+    @Autowired
+    private IWmBarcodeService wmBarcodeService;
+
+    /**
+     * 查询条码清单列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmBarcode wmBarcode)
+    {
+        startPage();
+        List<WmBarcode> list = wmBarcodeService.selectWmBarcodeList(wmBarcode);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出条码清单列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:barcode:export')")
+    @Log(title = "条码清单", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmBarcode wmBarcode)
+    {
+        List<WmBarcode> list = wmBarcodeService.selectWmBarcodeList(wmBarcode);
+        ExcelUtil<WmBarcode> util = new ExcelUtil<WmBarcode>(WmBarcode.class);
+        return util.exportExcel( list, "条码清单数据");
+    }
+
+    /**
+     * 获取条码清单详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:barcode:query')")
+    @GetMapping(value = "/{barcodeId}")
+    public Response getInfo(@PathVariable("barcodeId") Long barcodeId)
+    {
+        return Response.success(wmBarcodeService.selectWmBarcodeByBarcodeId(barcodeId));
+    }
+
+    /**
+     * 新增条码清单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:barcode:add')")
+    @Log(title = "条码清单", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmBarcode wmBarcode)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(wmBarcodeService.checkBarcodeUnique(wmBarcode))){
+            throw new CustomException("当前业务内容的条码已存在!");
+        }
+
+        String path =wmBarcodeService.generateBarcode(wmBarcode);
+        wmBarcode.setBarcodeUrl(path);
+        return toResponse(wmBarcodeService.insertWmBarcode(wmBarcode));
+    }
+
+    /**
+     * 修改条码清单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:barcode:edit')")
+    @Log(title = "条码清单", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmBarcode wmBarcode)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(wmBarcodeService.checkBarcodeUnique(wmBarcode))){
+            throw new CustomException("当前业务内容的条码已存在!");
+        }
+        String path =wmBarcodeService.generateBarcode(wmBarcode);
+        wmBarcode.setBarcodeUrl(path);
+        return toResponse(wmBarcodeService.updateWmBarcode(wmBarcode));
+    }
+
+    /**
+     * 删除条码清单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:barcode:remove')")
+    @Log(title = "条码清单", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{barcodeIds}")
+    public Response remove(@PathVariable Long[] barcodeIds)
+    {
+        return toResponse(wmBarcodeService.deleteWmBarcodeByBarcodeIds(barcodeIds));
+    }
+}

+ 212 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmIssueHeaderController.java

@@ -0,0 +1,212 @@
+package com.miaxis.mes.controller.wm;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import cn.hutool.core.collection.CollUtil;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.mes.wm.domain.*;
+import com.miaxis.mes.wm.domain.*;
+import com.miaxis.mes.wm.domain.tx.IssueTxBean;
+import com.miaxis.mes.wm.service.*;
+import com.miaxis.mes.wm.service.*;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 生产领料单头Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-07-14
+ */
+@RestController
+@RequestMapping("/mes/wm/issueheader")
+public class WmIssueHeaderController extends BaseController
+{
+    @Autowired
+    private IWmIssueHeaderService wmIssueHeaderService;
+
+    @Autowired
+    private IWmIssueLineService wmIssueLineService;
+
+    @Autowired
+    private IStorageCoreService storageCoreService;
+
+    @Autowired
+    private IWmWarehouseService wmWarehouseService;
+
+    @Autowired
+    private IWmStorageLocationService wmStorageLocationService;
+
+    @Autowired
+    private IWmStorageAreaService wmStorageAreaService;
+
+    /**
+     * 查询生产领料单头列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmIssueHeader wmIssueHeader)
+    {
+        startPage();
+        List<WmIssueHeader> list = wmIssueHeaderService.selectWmIssueHeaderList(wmIssueHeader);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出生产领料单头列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:export')")
+    @Log(title = "生产领料单头", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmIssueHeader wmIssueHeader)
+    {
+        List<WmIssueHeader> list = wmIssueHeaderService.selectWmIssueHeaderList(wmIssueHeader);
+        ExcelUtil<WmIssueHeader> util = new ExcelUtil<WmIssueHeader>(WmIssueHeader.class);
+        return util.exportExcel( list, "生产领料单头数据");
+    }
+
+    /**
+     * 获取生产领料单头详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:query')")
+    @GetMapping(value = "/{issueId}")
+    public Response getInfo(@PathVariable("issueId") Long issueId)
+    {
+        return Response.success(wmIssueHeaderService.selectWmIssueHeaderByIssueId(issueId));
+    }
+
+    /**
+     * 新增生产领料单头
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:add')")
+    @Log(title = "生产领料单头", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmIssueHeader wmIssueHeader)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(wmIssueHeaderService.checkIssueCodeUnique(wmIssueHeader))){
+            throw new CustomException("领料单编号已存在");
+        }
+        //根据领料单头上的仓库、库区、库位ID设置对应的编号和名称
+        if(StringUtils.isNotNull(wmIssueHeader.getWarehouseId())){
+            WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmIssueHeader.getWarehouseId());
+            wmIssueHeader.setWarehouseCode(warehouse.getWarehouseCode());
+            wmIssueHeader.setWarehouseName(warehouse.getWarehouseName());
+        }
+
+        if(StringUtils.isNotNull(wmIssueHeader.getLocationId())){
+            WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmIssueHeader.getLocationId());
+            wmIssueHeader.setLocationCode(location.getLocationCode());
+            wmIssueHeader.setLocationName(location.getLocationName());
+        }
+
+        if(StringUtils.isNotNull(wmIssueHeader.getAreaId())){
+            WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmIssueHeader.getAreaId());
+            wmIssueHeader.setAreaCode(area.getAreaCode());
+            wmIssueHeader.setAreaName(area.getAreaName());
+        }
+        wmIssueHeader.setCreateBy(getUsername());
+        return toResponse(wmIssueHeaderService.insertWmIssueHeader(wmIssueHeader));
+    }
+
+    /**
+     * 修改生产领料单头
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:edit')")
+    @Log(title = "生产领料单头", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmIssueHeader wmIssueHeader)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(wmIssueHeaderService.checkIssueCodeUnique(wmIssueHeader))){
+            throw new CustomException("领料单编号已存在");
+        }
+
+        //根据领料单头上的仓库、库区、库位ID设置对应的编号和名称
+        if(StringUtils.isNotNull(wmIssueHeader.getWarehouseId())){
+            WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmIssueHeader.getWarehouseId());
+            wmIssueHeader.setWarehouseCode(warehouse.getWarehouseCode());
+            wmIssueHeader.setWarehouseName(warehouse.getWarehouseName());
+        }
+
+        if(StringUtils.isNotNull(wmIssueHeader.getLocationId())){
+            WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmIssueHeader.getLocationId());
+            wmIssueHeader.setLocationCode(location.getLocationCode());
+            wmIssueHeader.setLocationName(location.getLocationName());
+        }
+
+        if(StringUtils.isNotNull(wmIssueHeader.getAreaId())){
+            WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmIssueHeader.getAreaId());
+            wmIssueHeader.setAreaCode(area.getAreaCode());
+            wmIssueHeader.setAreaName(area.getAreaName());
+        }
+        return toResponse(wmIssueHeaderService.updateWmIssueHeader(wmIssueHeader));
+    }
+
+    /**
+     * 删除生产领料单头
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:remove')")
+    @Log(title = "生产领料单头", businessType = BusinessTypeEnum.DELETE)
+    @Transactional
+	@DeleteMapping("/{issueIds}")
+    public Response remove(@PathVariable Long[] issueIds)
+    {
+        for (long issueId:issueIds
+             ) {
+            WmIssueHeader header = wmIssueHeaderService.selectWmIssueHeaderByIssueId(issueId);
+            if(!UserConstants.ORDER_STATUS_PREPARE.equals(header.getStatus())){
+                throw new CustomException("只能删除草稿状态的单据!");
+            }
+
+            wmIssueLineService.deleteByIssueHeaderId(issueId);
+        }
+
+        return toResponse(wmIssueHeaderService.deleteWmIssueHeaderByIssueIds(issueIds));
+    }
+
+    /**
+     * 执行出库
+     * @return
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:edit')")
+    @Log(title = "生产领料单头", businessType = BusinessTypeEnum.UPDATE)
+    @Transactional
+    @PutMapping("/{issueId}")
+    public Response execute(@PathVariable Long issueId){
+        WmIssueHeader header = wmIssueHeaderService.selectWmIssueHeaderByIssueId(issueId);
+        WmIssueLine param = new WmIssueLine();
+        param.setIssueId(issueId);
+        List<WmIssueLine> lines = wmIssueLineService.selectWmIssueLineList(param);
+        if(CollUtil.isEmpty(lines)){
+            throw new CustomException("请指定领出的物资");
+        }
+
+        List<IssueTxBean> beans = wmIssueHeaderService.getTxBeans(issueId);
+
+        //调用库存核心
+        storageCoreService.processIssue(beans);
+
+        //更新单据状态
+        header.setStatus(UserConstants.ORDER_STATUS_FINISHED);
+        wmIssueHeaderService.updateWmIssueHeader(header);
+        return Response.success();
+    }
+
+
+}

+ 105 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmIssueLineController.java

@@ -0,0 +1,105 @@
+package com.miaxis.mes.controller.wm;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.wm.domain.WmIssueLine;
+import com.miaxis.mes.wm.service.IWmIssueLineService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 生产领料单行Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-07-14
+ */
+@RestController
+@RequestMapping("/mes/wm/issueline")
+public class WmIssueLineController extends BaseController
+{
+    @Autowired
+    private IWmIssueLineService wmIssueLineService;
+
+    /**
+     * 查询生产领料单行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmIssueLine wmIssueLine)
+    {
+        startPage();
+        List<WmIssueLine> list = wmIssueLineService.selectWmIssueLineList(wmIssueLine);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出生产领料单行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:export')")
+    @Log(title = "生产领料单行", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmIssueLine wmIssueLine)
+    {
+        List<WmIssueLine> list = wmIssueLineService.selectWmIssueLineList(wmIssueLine);
+        ExcelUtil<WmIssueLine> util = new ExcelUtil<WmIssueLine>(WmIssueLine.class);
+        return util.exportExcel( list, "生产领料单行数据");
+    }
+
+    /**
+     * 获取生产领料单行详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:query')")
+    @GetMapping(value = "/{lineId}")
+    public Response getInfo(@PathVariable("lineId") Long lineId)
+    {
+        return Response.success(wmIssueLineService.selectWmIssueLineByLineId(lineId));
+    }
+
+    /**
+     * 新增生产领料单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:add')")
+    @Log(title = "生产领料单行", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmIssueLine wmIssueLine)
+    {
+        wmIssueLine.setCreateBy(getUsername());
+        return toResponse(wmIssueLineService.insertWmIssueLine(wmIssueLine));
+    }
+
+    /**
+     * 修改生产领料单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:edit')")
+    @Log(title = "生产领料单行", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmIssueLine wmIssueLine)
+    {
+        return toResponse(wmIssueLineService.updateWmIssueLine(wmIssueLine));
+    }
+
+    /**
+     * 删除生产领料单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:remove')")
+    @Log(title = "生产领料单行", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{lineIds}")
+    public Response remove(@PathVariable Long[] lineIds)
+    {
+        return toResponse(wmIssueLineService.deleteWmIssueLineByLineIds(lineIds));
+    }
+}

+ 104 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmItemConsumeController.java

@@ -0,0 +1,104 @@
+package com.miaxis.mes.controller.wm;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.wm.domain.WmItemConsume;
+import com.miaxis.mes.wm.service.IWmItemConsumeService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 物料消耗记录Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-09-19
+ */
+@RestController
+@RequestMapping("/mes/wm/itemconsume")
+public class WmItemConsumeController extends BaseController
+{
+    @Autowired
+    private IWmItemConsumeService wmItemConsumeService;
+
+    /**
+     * 查询物料消耗记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:itemconsume:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmItemConsume wmItemConsume)
+    {
+        startPage();
+        List<WmItemConsume> list = wmItemConsumeService.selectWmItemConsumeList(wmItemConsume);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出物料消耗记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:itemconsume:export')")
+    @Log(title = "物料消耗记录", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmItemConsume wmItemConsume)
+    {
+        List<WmItemConsume> list = wmItemConsumeService.selectWmItemConsumeList(wmItemConsume);
+        ExcelUtil<WmItemConsume> util = new ExcelUtil<WmItemConsume>(WmItemConsume.class);
+        return util.exportExcel( list, "物料消耗记录数据");
+    }
+
+    /**
+     * 获取物料消耗记录详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:itemconsume:query')")
+    @GetMapping(value = "/{recordId}")
+    public Response getInfo(@PathVariable("recordId") Long recordId)
+    {
+        return Response.success(wmItemConsumeService.selectWmItemConsumeByRecordId(recordId));
+    }
+
+    /**
+     * 新增物料消耗记录
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:itemconsume:add')")
+    @Log(title = "物料消耗记录", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmItemConsume wmItemConsume)
+    {
+        return toResponse(wmItemConsumeService.insertWmItemConsume(wmItemConsume));
+    }
+
+    /**
+     * 修改物料消耗记录
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:itemconsume:edit')")
+    @Log(title = "物料消耗记录", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmItemConsume wmItemConsume)
+    {
+        return toResponse(wmItemConsumeService.updateWmItemConsume(wmItemConsume));
+    }
+
+    /**
+     * 删除物料消耗记录
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:itemconsume:remove')")
+    @Log(title = "物料消耗记录", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{recordIds}")
+    public Response remove(@PathVariable Long[] recordIds)
+    {
+        return toResponse(wmItemConsumeService.deleteWmItemConsumeByRecordIds(recordIds));
+    }
+}

+ 104 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmItemConsumeLineController.java

@@ -0,0 +1,104 @@
+package com.miaxis.mes.controller.wm;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.wm.domain.WmItemConsumeLine;
+import com.miaxis.mes.wm.service.IWmItemConsumeLineService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 物料消耗记录行Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-09-19
+ */
+@RestController
+@RequestMapping("/mes/wm/itemconsumeline")
+public class WmItemConsumeLineController extends BaseController
+{
+    @Autowired
+    private IWmItemConsumeLineService wmItemConsumeLineService;
+
+    /**
+     * 查询物料消耗记录行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:itemconsume:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmItemConsumeLine wmItemConsumeLine)
+    {
+        startPage();
+        List<WmItemConsumeLine> list = wmItemConsumeLineService.selectWmItemConsumeLineList(wmItemConsumeLine);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出物料消耗记录行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:itemconsume:export')")
+    @Log(title = "物料消耗记录行", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmItemConsumeLine wmItemConsumeLine)
+    {
+        List<WmItemConsumeLine> list = wmItemConsumeLineService.selectWmItemConsumeLineList(wmItemConsumeLine);
+        ExcelUtil<WmItemConsumeLine> util = new ExcelUtil<WmItemConsumeLine>(WmItemConsumeLine.class);
+        return util.exportExcel( list, "物料消耗记录行数据");
+    }
+
+    /**
+     * 获取物料消耗记录行详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:itemconsume:query')")
+    @GetMapping(value = "/{lineId}")
+    public Response getInfo(@PathVariable("lineId") Long lineId)
+    {
+        return Response.success(wmItemConsumeLineService.selectWmItemConsumeLineByLineId(lineId));
+    }
+
+    /**
+     * 新增物料消耗记录行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:itemconsume:add')")
+    @Log(title = "物料消耗记录行", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmItemConsumeLine wmItemConsumeLine)
+    {
+        return toResponse(wmItemConsumeLineService.insertWmItemConsumeLine(wmItemConsumeLine));
+    }
+
+    /**
+     * 修改物料消耗记录行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:itemconsume:edit')")
+    @Log(title = "物料消耗记录行", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmItemConsumeLine wmItemConsumeLine)
+    {
+        return toResponse(wmItemConsumeLineService.updateWmItemConsumeLine(wmItemConsumeLine));
+    }
+
+    /**
+     * 删除物料消耗记录行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:itemconsume:remove')")
+    @Log(title = "物料消耗记录行", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{lineIds}")
+    public Response remove(@PathVariable Long[] lineIds)
+    {
+        return toResponse(wmItemConsumeLineService.deleteWmItemConsumeLineByLineIds(lineIds));
+    }
+}

+ 237 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmItemRecptController.java

@@ -0,0 +1,237 @@
+package com.miaxis.mes.controller.wm;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import cn.hutool.core.collection.CollUtil;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.mes.wm.domain.*;
+import com.miaxis.mes.wm.domain.*;
+import com.miaxis.mes.wm.domain.tx.ItemRecptTxBean;
+import com.miaxis.mes.wm.service.*;
+import com.miaxis.mes.wm.service.*;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 物料入库单Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-22
+ */
+@RestController
+@RequestMapping("/mes/wm/itemrecpt")
+public class WmItemRecptController extends BaseController
+{
+    @Autowired
+    private IWmItemRecptService wmItemRecptService;
+
+    @Autowired
+    private IWmItemRecptLineService wmItemRecptLineService;
+
+    @Autowired
+    private IWmWarehouseService wmWarehouseService;
+
+    @Autowired
+    private IWmStorageLocationService wmStorageLocationService;
+
+    @Autowired
+    private IWmStorageAreaService wmStorageAreaService;
+
+    @Autowired
+    private IStorageCoreService storageCoreService;
+
+    /**
+     * 查询物料入库单列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmItemRecpt wmItemRecpt)
+    {
+        startPage();
+        List<WmItemRecpt> list = wmItemRecptService.selectWmItemRecptList(wmItemRecpt);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出物料入库单列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:export')")
+    @Log(title = "物料入库单", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmItemRecpt wmItemRecpt)
+    {
+        List<WmItemRecpt> list = wmItemRecptService.selectWmItemRecptList(wmItemRecpt);
+        ExcelUtil<WmItemRecpt> util = new ExcelUtil<WmItemRecpt>(WmItemRecpt.class);
+        return util.exportExcel( list, "物料入库单数据");
+    }
+
+    /**
+     * 获取物料入库单详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:query')")
+    @GetMapping(value = "/{recptId}")
+    public Response getInfo(@PathVariable("recptId") Long recptId)
+    {
+        return Response.success(wmItemRecptService.selectWmItemRecptByRecptId(recptId));
+    }
+
+    /**
+     * 新增物料入库单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:add')")
+    @Log(title = "物料入库单", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmItemRecpt wmItemRecpt)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(wmItemRecptService.checkRecptCodeUnique(wmItemRecpt))){
+            throw new CustomException("单据编号已存在!");
+        }
+
+        if(StringUtils.isNotNull(wmItemRecpt.getWarehouseId())){
+           WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmItemRecpt.getWarehouseId());
+           wmItemRecpt.setWarehouseCode(warehouse.getWarehouseCode());
+           wmItemRecpt.setWarehouseName(warehouse.getWarehouseName());
+        }
+        if(StringUtils.isNotNull(wmItemRecpt.getLocationId())){
+           WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmItemRecpt.getLocationId());
+           wmItemRecpt.setLocationCode(location.getLocationCode());
+           wmItemRecpt.setLocationName(location.getLocationName());
+        }
+        if(StringUtils.isNotNull(wmItemRecpt.getAreaId())){
+           WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmItemRecpt.getAreaId());
+           wmItemRecpt.setAreaCode(area.getAreaCode());
+           wmItemRecpt.setAreaName(area.getAreaName());
+        }
+
+        wmItemRecpt.setCreateBy(getUsername());
+        return toResponse(wmItemRecptService.insertWmItemRecpt(wmItemRecpt));
+    }
+
+    /**
+     * 确认入库单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:edit')")
+    @Log(title = "物料入库单", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping("/confirm")
+    public Response confirm(@RequestBody WmItemRecpt wmItemRecpt){
+        //检查有没有入库单行
+        WmItemRecptLine param = new WmItemRecptLine();
+        param.setRecptId(wmItemRecpt.getRecptId());
+        List<WmItemRecptLine> lines = wmItemRecptLineService.selectWmItemRecptLineList(param);
+        if(CollUtil.isEmpty(lines)){
+            throw new CustomException("请添加入库单行");
+        }
+
+        wmItemRecpt.setStatus(UserConstants.ORDER_STATUS_CONFIRMED);
+
+        if(StringUtils.isNotNull(wmItemRecpt.getWarehouseId())){
+            WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmItemRecpt.getWarehouseId());
+            wmItemRecpt.setWarehouseCode(warehouse.getWarehouseCode());
+            wmItemRecpt.setWarehouseName(warehouse.getWarehouseName());
+        }
+        if(StringUtils.isNotNull(wmItemRecpt.getLocationId())){
+            WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmItemRecpt.getLocationId());
+            wmItemRecpt.setLocationCode(location.getLocationCode());
+            wmItemRecpt.setLocationName(location.getLocationName());
+        }
+        if(StringUtils.isNotNull(wmItemRecpt.getAreaId())){
+            WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmItemRecpt.getAreaId());
+            wmItemRecpt.setAreaCode(area.getAreaCode());
+            wmItemRecpt.setAreaName(area.getAreaName());
+        }
+        return toResponse(wmItemRecptService.updateWmItemRecpt(wmItemRecpt));
+    }
+
+
+    /**
+     * 修改物料入库单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:edit')")
+    @Log(title = "物料入库单", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmItemRecpt wmItemRecpt)
+    {
+        if(StringUtils.isNotNull(wmItemRecpt.getWarehouseId())){
+            WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmItemRecpt.getWarehouseId());
+            wmItemRecpt.setWarehouseCode(warehouse.getWarehouseCode());
+            wmItemRecpt.setWarehouseName(warehouse.getWarehouseName());
+        }
+        if(StringUtils.isNotNull(wmItemRecpt.getLocationId())){
+            WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmItemRecpt.getLocationId());
+            wmItemRecpt.setLocationCode(location.getLocationCode());
+            wmItemRecpt.setLocationName(location.getLocationName());
+        }
+        if(StringUtils.isNotNull(wmItemRecpt.getAreaId())){
+            WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmItemRecpt.getAreaId());
+            wmItemRecpt.setAreaCode(area.getAreaCode());
+            wmItemRecpt.setAreaName(area.getAreaName());
+        }
+        return toResponse(wmItemRecptService.updateWmItemRecpt(wmItemRecpt));
+    }
+
+    /**
+     * 执行入库
+     * @return
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:edit')")
+    @Log(title = "物料入库单", businessType = BusinessTypeEnum.UPDATE)
+    @Transactional
+    @PutMapping("/{recptId}")
+    public Response execute(@PathVariable Long recptId){
+
+        WmItemRecpt recpt = wmItemRecptService.selectWmItemRecptByRecptId(recptId);
+
+        //构造Transaction事务,并执行库存更新逻辑
+        List<ItemRecptTxBean> beans = wmItemRecptService.getTxBeans(recptId);
+
+        //调用库存核心
+        storageCoreService.processItemRecpt(beans);
+
+        //更新单据状态
+        recpt.setStatus(UserConstants.ORDER_STATUS_FINISHED);
+        wmItemRecptService.updateWmItemRecpt(recpt);
+
+        return Response.success();
+    }
+
+
+    /**
+     * 删除物料入库单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:remove')")
+    @Log(title = "物料入库单", businessType = BusinessTypeEnum.DELETE)
+    @Transactional
+	@DeleteMapping("/{recptIds}")
+    public Response remove(@PathVariable Long[] recptIds)
+    {
+        for (Long id:
+                recptIds
+             ) {
+            WmItemRecpt itemRecpt = wmItemRecptService.selectWmItemRecptByRecptId(id);
+            if(!UserConstants.ORDER_STATUS_PREPARE.equals(itemRecpt.getStatus())){
+                throw new CustomException("只能删除草稿状态的单据!");
+            }
+
+            wmItemRecptLineService.deleteByRecptId(id);
+        }
+
+        return toResponse(wmItemRecptService.deleteWmItemRecptByRecptIds(recptIds));
+    }
+}

+ 153 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmItemRecptLineController.java

@@ -0,0 +1,153 @@
+package com.miaxis.mes.controller.wm;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.mes.wm.domain.WmStorageArea;
+import com.miaxis.mes.wm.domain.WmStorageLocation;
+import com.miaxis.mes.wm.domain.WmWarehouse;
+import com.miaxis.mes.wm.service.IWmStorageAreaService;
+import com.miaxis.mes.wm.service.IWmStorageLocationService;
+import com.miaxis.mes.wm.service.IWmWarehouseService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.wm.domain.WmItemRecptLine;
+import com.miaxis.mes.wm.service.IWmItemRecptLineService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 物料入库单行Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-22
+ */
+@RestController
+@RequestMapping("/mes/wm/itemrecptline")
+public class WmItemRecptLineController extends BaseController
+{
+    @Autowired
+    private IWmItemRecptLineService wmItemRecptLineService;
+
+
+    @Autowired
+    private IWmWarehouseService wmWarehouseService;
+
+    @Autowired
+    private IWmStorageLocationService wmStorageLocationService;
+
+    @Autowired
+    private IWmStorageAreaService wmStorageAreaService;
+
+    /**
+     * 查询物料入库单行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmItemRecptLine wmItemRecptLine)
+    {
+        startPage();
+        List<WmItemRecptLine> list = wmItemRecptLineService.selectWmItemRecptLineList(wmItemRecptLine);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出物料入库单行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:export')")
+    @Log(title = "物料入库单行", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmItemRecptLine wmItemRecptLine)
+    {
+        List<WmItemRecptLine> list = wmItemRecptLineService.selectWmItemRecptLineList(wmItemRecptLine);
+        ExcelUtil<WmItemRecptLine> util = new ExcelUtil<WmItemRecptLine>(WmItemRecptLine.class);
+        return util.exportExcel( list, "物料入库单行数据");
+    }
+
+    /**
+     * 获取物料入库单行详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:query')")
+    @GetMapping(value = "/{lineId}")
+    public Response getInfo(@PathVariable("lineId") Long lineId)
+    {
+        return Response.success(wmItemRecptLineService.selectWmItemRecptLineByLineId(lineId));
+    }
+
+    /**
+     * 新增物料入库单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:add')")
+    @Log(title = "物料入库单行", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmItemRecptLine wmItemRecptLine)
+    {
+        if(StringUtils.isNotNull(wmItemRecptLine.getWarehouseId())){
+            WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmItemRecptLine.getWarehouseId());
+            wmItemRecptLine.setWarehouseCode(warehouse.getWarehouseCode());
+            wmItemRecptLine.setWarehouseName(warehouse.getWarehouseName());
+        }
+        if(StringUtils.isNotNull(wmItemRecptLine.getLocationId())){
+            WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmItemRecptLine.getLocationId());
+            wmItemRecptLine.setLocationCode(location.getLocationCode());
+            wmItemRecptLine.setLocationName(location.getLocationName());
+        }
+        if(StringUtils.isNotNull(wmItemRecptLine.getAreaId())){
+            WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmItemRecptLine.getAreaId());
+            wmItemRecptLine.setAreaCode(area.getAreaCode());
+            wmItemRecptLine.setAreaName(area.getAreaName());
+        }
+        wmItemRecptLine.setCreateBy(getUsername());
+        return toResponse(wmItemRecptLineService.insertWmItemRecptLine(wmItemRecptLine));
+    }
+
+    /**
+     * 修改物料入库单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:edit')")
+    @Log(title = "物料入库单行", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmItemRecptLine wmItemRecptLine)
+    {
+        if(StringUtils.isNotNull(wmItemRecptLine.getWarehouseId())){
+            WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmItemRecptLine.getWarehouseId());
+            wmItemRecptLine.setWarehouseCode(warehouse.getWarehouseCode());
+            wmItemRecptLine.setWarehouseName(warehouse.getWarehouseName());
+        }
+        if(StringUtils.isNotNull(wmItemRecptLine.getLocationId())){
+            WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmItemRecptLine.getLocationId());
+            wmItemRecptLine.setLocationCode(location.getLocationCode());
+            wmItemRecptLine.setLocationName(location.getLocationName());
+        }
+        if(StringUtils.isNotNull(wmItemRecptLine.getAreaId())){
+            WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmItemRecptLine.getAreaId());
+            wmItemRecptLine.setAreaCode(area.getAreaCode());
+            wmItemRecptLine.setAreaName(area.getAreaName());
+        }
+        return toResponse(wmItemRecptLineService.updateWmItemRecptLine(wmItemRecptLine));
+    }
+
+    /**
+     * 删除物料入库单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:remove')")
+    @Log(title = "物料入库单行", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{lineIds}")
+    public Response remove(@PathVariable Long[] lineIds)
+    {
+        return toResponse(wmItemRecptLineService.deleteWmItemRecptLineByLineIds(lineIds));
+    }
+}

+ 97 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmMaterialStockController.java

@@ -0,0 +1,97 @@
+package com.miaxis.mes.controller.wm;
+
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.wm.domain.WmMaterialStock;
+import com.miaxis.mes.wm.service.IWmMaterialStockService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 库存记录Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-05-30
+ */
+@RestController
+@RequestMapping("/mes/wm/wmstock")
+public class WmMaterialStockController extends BaseController
+{
+    @Autowired
+    private IWmMaterialStockService wmMaterialStockService;
+
+    /**
+     * 查询库存记录列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmMaterialStock wmMaterialStock)
+    {
+        startPage();
+        List<WmMaterialStock> list = wmMaterialStockService.selectWmMaterialStockList(wmMaterialStock);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出库存记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:wmstock:export')")
+    @Log(title = "库存记录", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmMaterialStock wmMaterialStock)
+    {
+        List<WmMaterialStock> list = wmMaterialStockService.selectWmMaterialStockList(wmMaterialStock);
+        ExcelUtil<WmMaterialStock> util = new ExcelUtil<WmMaterialStock>(WmMaterialStock.class);
+        return util.exportExcel( list, "库存记录数据");
+    }
+
+    /**
+     * 获取库存记录详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:wmstock:query')")
+    @GetMapping(value = "/{materialStockId}")
+    public Response getInfo(@PathVariable("materialStockId") Long materialStockId)
+    {
+        return Response.success(wmMaterialStockService.selectWmMaterialStockByMaterialStockId(materialStockId));
+    }
+
+    /**
+     * 新增库存记录
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:wmstock:add')")
+    @Log(title = "库存记录", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmMaterialStock wmMaterialStock)
+    {
+        return toResponse(wmMaterialStockService.insertWmMaterialStock(wmMaterialStock));
+    }
+
+    /**
+     * 修改库存记录
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:wmstock:edit')")
+    @Log(title = "库存记录", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmMaterialStock wmMaterialStock)
+    {
+        return toResponse(wmMaterialStockService.updateWmMaterialStock(wmMaterialStock));
+    }
+
+    /**
+     * 删除库存记录
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:wmstock:remove')")
+    @Log(title = "库存记录", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{materialStockIds}")
+    public Response remove(@PathVariable Long[] materialStockIds)
+    {
+        return toResponse(wmMaterialStockService.deleteWmMaterialStockByMaterialStockIds(materialStockIds));
+    }
+}

+ 143 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmOutsourceIssueController.java

@@ -0,0 +1,143 @@
+package com.miaxis.mes.controller.wm;
+
+import cn.hutool.core.collection.CollUtil;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.wm.domain.WmOutsourceIssue;
+import com.miaxis.mes.wm.domain.WmOutsourceIssueLine;
+import com.miaxis.mes.wm.domain.tx.OutsourceIssueTxBean;
+import com.miaxis.mes.wm.service.IStorageCoreService;
+import com.miaxis.mes.wm.service.IWmOutsourceIssueLineService;
+import com.miaxis.mes.wm.service.IWmOutsourceIssueService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 外协领料单头Controller
+ * 
+ * @author yinjinlu
+ * @date 2023-10-30
+ */
+@RestController
+@RequestMapping("/mes/wm/outsourceissue")
+public class WmOutsourceIssueController extends BaseController
+{
+    @Autowired
+    private IWmOutsourceIssueService wmOutsourceIssueService;
+
+    @Autowired
+    private IWmOutsourceIssueLineService wmOutsourceIssueLineService;
+
+    @Autowired
+    private IStorageCoreService storageCoreService;
+
+    /**
+     * 查询外协领料单头列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:outsourceissue:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmOutsourceIssue wmOutsourceIssue)
+    {
+        startPage();
+        List<WmOutsourceIssue> list = wmOutsourceIssueService.selectWmOutsourceIssueList(wmOutsourceIssue);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出外协领料单头列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:outsourceissue:export')")
+    @Log(title = "外协领料单头", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmOutsourceIssue wmOutsourceIssue)
+    {
+        List<WmOutsourceIssue> list = wmOutsourceIssueService.selectWmOutsourceIssueList(wmOutsourceIssue);
+        ExcelUtil<WmOutsourceIssue> util = new ExcelUtil<WmOutsourceIssue>(WmOutsourceIssue.class);
+        return util.exportExcel( list, "外协领料单头数据");
+    }
+
+    /**
+     * 获取外协领料单头详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:outsourceissue:query')")
+    @GetMapping(value = "/{issueId}")
+    public Response getInfo(@PathVariable("issueId") Long issueId)
+    {
+        return Response.success(wmOutsourceIssueService.selectWmOutsourceIssueByIssueId(issueId));
+    }
+
+    /**
+     * 新增外协领料单头
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:outsourceissue:add')")
+    @Log(title = "外协领料单头", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmOutsourceIssue wmOutsourceIssue)
+    {
+        return toResponse(wmOutsourceIssueService.insertWmOutsourceIssue(wmOutsourceIssue));
+    }
+
+    /**
+     * 修改外协领料单头
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:outsourceissue:edit')")
+    @Log(title = "外协领料单头", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmOutsourceIssue wmOutsourceIssue)
+    {
+        return toResponse(wmOutsourceIssueService.updateWmOutsourceIssue(wmOutsourceIssue));
+    }
+
+    /**
+     * 删除外协领料单头
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:outsourceissue:remove')")
+    @Log(title = "外协领料单头", businessType = BusinessTypeEnum.DELETE)
+    @Transactional
+	@DeleteMapping("/{issueIds}")
+    public Response remove(@PathVariable Long[] issueIds)
+    {
+        for (Long issueId:issueIds
+             ) {
+            wmOutsourceIssueLineService.deleteWmOutsourceIssueLineByIssueId(issueId);
+        }
+        return toResponse(wmOutsourceIssueService.deleteWmOutsourceIssueByIssueIds(issueIds));
+    }
+
+    /**
+     * 执行出库
+     * @return
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:outsourceissue:edit')")
+    @Log(title = "外协领料单头", businessType = BusinessTypeEnum.UPDATE)
+    @Transactional
+    @PutMapping("/{issueId}")
+    public Response execute(@PathVariable Long issueId){
+        WmOutsourceIssue header = wmOutsourceIssueService.selectWmOutsourceIssueByIssueId(issueId);
+        WmOutsourceIssueLine param = new WmOutsourceIssueLine();
+        param.setIssueId(issueId);
+        List<WmOutsourceIssueLine> lines = wmOutsourceIssueLineService.selectWmOutsourceIssueLineList(param);
+        if(CollUtil.isEmpty(lines)){
+            throw new CustomException("请指定领出的物资");
+        }
+
+        List<OutsourceIssueTxBean> beans = wmOutsourceIssueService.getTxBeans(issueId);
+
+        storageCoreService.processOutsourceIssue(beans);
+        //更新单据状态
+        header.setStatus(UserConstants.ORDER_STATUS_FINISHED);
+        wmOutsourceIssueService.updateWmOutsourceIssue(header);
+        return Response.success();
+    }
+}

+ 104 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmOutsourceIssueLineController.java

@@ -0,0 +1,104 @@
+package com.miaxis.mes.controller.wm;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.wm.domain.WmOutsourceIssueLine;
+import com.miaxis.mes.wm.service.IWmOutsourceIssueLineService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 外协领料单行Controller
+ * 
+ * @author yinjinlu
+ * @date 2023-10-30
+ */
+@RestController
+@RequestMapping("/mes/wm/outsourceissueline")
+public class WmOutsourceIssueLineController extends BaseController
+{
+    @Autowired
+    private IWmOutsourceIssueLineService wmOutsourceIssueLineService;
+
+    /**
+     * 查询外协领料单行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:outsourceissue:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmOutsourceIssueLine wmOutsourceIssueLine)
+    {
+        startPage();
+        List<WmOutsourceIssueLine> list = wmOutsourceIssueLineService.selectWmOutsourceIssueLineList(wmOutsourceIssueLine);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出外协领料单行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:outsourceissue:export')")
+    @Log(title = "外协领料单行", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmOutsourceIssueLine wmOutsourceIssueLine)
+    {
+        List<WmOutsourceIssueLine> list = wmOutsourceIssueLineService.selectWmOutsourceIssueLineList(wmOutsourceIssueLine);
+        ExcelUtil<WmOutsourceIssueLine> util = new ExcelUtil<WmOutsourceIssueLine>(WmOutsourceIssueLine.class);
+        return util.exportExcel( list, "外协领料单行数据");
+    }
+
+    /**
+     * 获取外协领料单行详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:outsourceissue:query')")
+    @GetMapping(value = "/{lineId}")
+    public Response getInfo(@PathVariable("lineId") Long lineId)
+    {
+        return Response.success(wmOutsourceIssueLineService.selectWmOutsourceIssueLineByLineId(lineId));
+    }
+
+    /**
+     * 新增外协领料单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:outsourceissue:add')")
+    @Log(title = "外协领料单行", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmOutsourceIssueLine wmOutsourceIssueLine)
+    {
+        return toResponse(wmOutsourceIssueLineService.insertWmOutsourceIssueLine(wmOutsourceIssueLine));
+    }
+
+    /**
+     * 修改外协领料单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:outsourceissue:edit')")
+    @Log(title = "外协领料单行", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmOutsourceIssueLine wmOutsourceIssueLine)
+    {
+        return toResponse(wmOutsourceIssueLineService.updateWmOutsourceIssueLine(wmOutsourceIssueLine));
+    }
+
+    /**
+     * 删除外协领料单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:outsourceissue:remove')")
+    @Log(title = "外协领料单行", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{lineIds}")
+    public Response remove(@PathVariable Long[] lineIds)
+    {
+        return toResponse(wmOutsourceIssueLineService.deleteWmOutsourceIssueLineByLineIds(lineIds));
+    }
+}

+ 179 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmOutsourceRecptController.java

@@ -0,0 +1,179 @@
+package com.miaxis.mes.controller.wm;
+
+import java.math.BigDecimal;
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.mes.pro.domain.ProWorkorder;
+import com.miaxis.mes.pro.service.IProWorkorderService;
+import com.miaxis.mes.wm.domain.WmOutsourceRecptLine;
+import com.miaxis.mes.wm.domain.tx.OutsourceRecptTxBean;
+import com.miaxis.mes.wm.service.IStorageCoreService;
+import com.miaxis.mes.wm.service.IWmOutsourceRecptLineService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.wm.domain.WmOutsourceRecpt;
+import com.miaxis.mes.wm.service.IWmOutsourceRecptService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 外协入库单Controller
+ * 
+ * @author yinjinlu
+ * @date 2023-10-30
+ */
+@RestController
+@RequestMapping("/mes/wm/outsourcerecpt")
+public class WmOutsourceRecptController extends BaseController
+{
+    @Autowired
+    private IWmOutsourceRecptService wmOutsourceRecptService;
+
+    @Autowired
+    private IWmOutsourceRecptLineService wmOutsourceRecptLineService;
+
+    @Autowired
+    private IStorageCoreService storageCoreService;
+
+    @Autowired
+    private IProWorkorderService proWorkorderService;
+
+
+    /**
+     * 查询外协入库单列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:outsourcerecpt:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmOutsourceRecpt wmOutsourceRecpt)
+    {
+        startPage();
+        List<WmOutsourceRecpt> list = wmOutsourceRecptService.selectWmOutsourceRecptList(wmOutsourceRecpt);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出外协入库单列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:outsourcerecpt:export')")
+    @Log(title = "外协入库单", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmOutsourceRecpt wmOutsourceRecpt)
+    {
+        List<WmOutsourceRecpt> list = wmOutsourceRecptService.selectWmOutsourceRecptList(wmOutsourceRecpt);
+        ExcelUtil<WmOutsourceRecpt> util = new ExcelUtil<WmOutsourceRecpt>(WmOutsourceRecpt.class);
+        return util.exportExcel( list, "外协入库单数据");
+    }
+
+    /**
+     * 获取外协入库单详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:outsourcerecpt:query')")
+    @GetMapping(value = "/{recptId}")
+    public Response getInfo(@PathVariable("recptId") Long recptId)
+    {
+        return Response.success(wmOutsourceRecptService.selectWmOutsourceRecptByRecptId(recptId));
+    }
+
+    /**
+     * 新增外协入库单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:outsourcerecpt:add')")
+    @Log(title = "外协入库单", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmOutsourceRecpt wmOutsourceRecpt)
+    {
+        return toResponse(wmOutsourceRecptService.insertWmOutsourceRecpt(wmOutsourceRecpt));
+    }
+
+    /**
+     * 修改外协入库单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:outsourcerecpt:edit')")
+    @Log(title = "外协入库单", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmOutsourceRecpt wmOutsourceRecpt)
+    {
+        return toResponse(wmOutsourceRecptService.updateWmOutsourceRecpt(wmOutsourceRecpt));
+    }
+
+    /**
+     * 删除外协入库单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:outsourcerecpt:remove')")
+    @Log(title = "外协入库单", businessType = BusinessTypeEnum.DELETE)
+    @Transactional
+	@DeleteMapping("/{recptIds}")
+    public Response remove(@PathVariable Long[] recptIds)
+    {
+        for (Long recptId:recptIds
+             ) {
+            wmOutsourceRecptLineService.selectWmOutsourceRecptLineByRecptId(recptId);
+        }
+        return toResponse(wmOutsourceRecptService.deleteWmOutsourceRecptByRecptIds(recptIds));
+    }
+
+    /**
+     * 执行入库
+     * @return
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:outsourcerecpt:edit')")
+    @Log(title = "外协入库单", businessType = BusinessTypeEnum.UPDATE)
+    @Transactional
+    @PutMapping("/{recptId}")
+    public Response execute(@PathVariable Long recptId){
+
+        WmOutsourceRecpt recpt = wmOutsourceRecptService.selectWmOutsourceRecptByRecptId(recptId);
+
+        List<WmOutsourceRecptLine> lines = wmOutsourceRecptLineService.selectWmOutsourceRecptLineByRecptId(recptId);
+        if(CollectionUtils.isEmpty(lines)){
+            throw new CustomException("请指定入库的物资!");
+        }
+
+        //构造Transaction事务,并执行库存更新逻辑
+        List<OutsourceRecptTxBean> beans = wmOutsourceRecptService.getTxBeans(recptId);
+
+        //调用库存核心
+        storageCoreService.processOutsourceRecpt(beans);
+
+        //根据当前入库的物料更新对应的生产工单/生产任务 已生产数量
+        ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(recpt.getWorkorderId());
+        if(!StringUtils.isNotNull(workorder)){
+            throw new CustomException("未找到对应的外协工单/外协任务!");
+        }
+
+        //正常外协入库的产品必须先经过检验,确认合格数量后才能执行入库,并且更新外协工单的进度。此处暂时先直接根据入库数量更新外协工单的生产数量。
+        BigDecimal produced = workorder.getQuantityProduced() == null?new BigDecimal(0):workorder.getQuantityProduced();
+        for (int i = 0; i < lines.size(); i++) {
+            WmOutsourceRecptLine line = lines.get(i);
+            //判断入库的物资,如果是生产工单中的产品,则更新已生产数量
+            if(line.getItemCode().equals(workorder.getProductCode())){
+                workorder.setQuantityProduced( produced.add(line.getQuantityRecived()));
+            }
+        }
+        proWorkorderService.updateProWorkorder(workorder);
+
+        //更新单据状态
+        recpt.setStatus(UserConstants.ORDER_STATUS_FINISHED);
+        wmOutsourceRecptService.updateWmOutsourceRecpt(recpt);
+
+        return Response.success();
+    }
+
+}

+ 155 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmOutsourceRecptLineController.java

@@ -0,0 +1,155 @@
+package com.miaxis.mes.controller.wm;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.mes.wm.domain.WmStorageArea;
+import com.miaxis.mes.wm.domain.WmStorageLocation;
+import com.miaxis.mes.wm.domain.WmWarehouse;
+import com.miaxis.mes.wm.service.IWmStorageAreaService;
+import com.miaxis.mes.wm.service.IWmStorageLocationService;
+import com.miaxis.mes.wm.service.IWmWarehouseService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.wm.domain.WmOutsourceRecptLine;
+import com.miaxis.mes.wm.service.IWmOutsourceRecptLineService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 外协入库单行Controller
+ * 
+ * @author yinjinlu
+ * @date 2023-10-30
+ */
+@RestController
+@RequestMapping("/mes/wm/oursourcerecptline")
+public class WmOutsourceRecptLineController extends BaseController
+{
+    @Autowired
+    private IWmOutsourceRecptLineService wmOutsourceRecptLineService;
+
+
+    @Autowired
+    private IWmWarehouseService wmWarehouseService;
+
+    @Autowired
+    private IWmStorageLocationService wmStorageLocationService;
+
+    @Autowired
+    private IWmStorageAreaService wmStorageAreaService;
+
+    /**
+     * 查询外协入库单行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:oursourcerecpt:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmOutsourceRecptLine wmOutsourceRecptLine)
+    {
+        startPage();
+        List<WmOutsourceRecptLine> list = wmOutsourceRecptLineService.selectWmOutsourceRecptLineList(wmOutsourceRecptLine);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出外协入库单行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:oursourcerecpt:export')")
+    @Log(title = "外协入库单行", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmOutsourceRecptLine wmOutsourceRecptLine)
+    {
+        List<WmOutsourceRecptLine> list = wmOutsourceRecptLineService.selectWmOutsourceRecptLineList(wmOutsourceRecptLine);
+        ExcelUtil<WmOutsourceRecptLine> util = new ExcelUtil<WmOutsourceRecptLine>(WmOutsourceRecptLine.class);
+        return util.exportExcel( list, "外协入库单行数据");
+    }
+
+    /**
+     * 获取外协入库单行详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:oursourcerecpt:query')")
+    @GetMapping(value = "/{lineId}")
+    public Response getInfo(@PathVariable("lineId") Long lineId)
+    {
+        return Response.success(wmOutsourceRecptLineService.selectWmOutsourceRecptLineByLineId(lineId));
+    }
+
+    /**
+     * 新增外协入库单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:oursourcerecpt:add')")
+    @Log(title = "外协入库单行", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmOutsourceRecptLine wmOutsourceRecptLine)
+    {
+        if(StringUtils.isNotNull(wmOutsourceRecptLine.getWarehouseId())){
+            WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmOutsourceRecptLine.getWarehouseId());
+            wmOutsourceRecptLine.setWarehouseCode(warehouse.getWarehouseCode());
+            wmOutsourceRecptLine.setWarehouseName(warehouse.getWarehouseName());
+        }
+        if(StringUtils.isNotNull(wmOutsourceRecptLine.getLocationId())){
+            WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmOutsourceRecptLine.getLocationId());
+            wmOutsourceRecptLine.setLocationCode(location.getLocationCode());
+            wmOutsourceRecptLine.setLocationName(location.getLocationName());
+        }
+        if(StringUtils.isNotNull(wmOutsourceRecptLine.getAreaId())){
+            WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmOutsourceRecptLine.getAreaId());
+            wmOutsourceRecptLine.setAreaCode(area.getAreaCode());
+            wmOutsourceRecptLine.setAreaName(area.getAreaName());
+        }
+        wmOutsourceRecptLine.setCreateBy(getUsername());
+
+        return toResponse(wmOutsourceRecptLineService.insertWmOutsourceRecptLine(wmOutsourceRecptLine));
+    }
+
+    /**
+     * 修改外协入库单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:oursourcerecpt:edit')")
+    @Log(title = "外协入库单行", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmOutsourceRecptLine wmOutsourceRecptLine)
+    {
+        if(StringUtils.isNotNull(wmOutsourceRecptLine.getWarehouseId())){
+            WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmOutsourceRecptLine.getWarehouseId());
+            wmOutsourceRecptLine.setWarehouseCode(warehouse.getWarehouseCode());
+            wmOutsourceRecptLine.setWarehouseName(warehouse.getWarehouseName());
+        }
+        if(StringUtils.isNotNull(wmOutsourceRecptLine.getLocationId())){
+            WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmOutsourceRecptLine.getLocationId());
+            wmOutsourceRecptLine.setLocationCode(location.getLocationCode());
+            wmOutsourceRecptLine.setLocationName(location.getLocationName());
+        }
+        if(StringUtils.isNotNull(wmOutsourceRecptLine.getAreaId())){
+            WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmOutsourceRecptLine.getAreaId());
+            wmOutsourceRecptLine.setAreaCode(area.getAreaCode());
+            wmOutsourceRecptLine.setAreaName(area.getAreaName());
+        }
+
+        return toResponse(wmOutsourceRecptLineService.updateWmOutsourceRecptLine(wmOutsourceRecptLine));
+    }
+
+    /**
+     * 删除外协入库单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:oursourcerecpt:remove')")
+    @Log(title = "外协入库单行", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{lineIds}")
+    public Response remove(@PathVariable Long[] lineIds)
+    {
+        return toResponse(wmOutsourceRecptLineService.deleteWmOutsourceRecptLineByLineIds(lineIds));
+    }
+}

+ 166 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmPackageController.java

@@ -0,0 +1,166 @@
+package com.miaxis.mes.controller.wm;
+
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.wm.domain.WmBarcode;
+import com.miaxis.mes.wm.domain.WmPackage;
+import com.miaxis.mes.wm.service.IWmBarcodeService;
+import com.miaxis.mes.wm.service.IWmPackageService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 装箱单Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-10-10
+ */
+@RestController
+@RequestMapping("/mes/wm/package")
+public class WmPackageController extends BaseController
+{
+    @Autowired
+    private IWmPackageService wmPackageService;
+
+    @Autowired
+    private IWmBarcodeService wmBarcodeService;
+
+    /**
+     * 查询装箱单列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmPackage wmPackage)
+    {
+        startPage();
+        List<WmPackage> list = wmPackageService.selectWmPackageList(wmPackage);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出装箱单列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:package:export')")
+    @Log(title = "装箱单", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmPackage wmPackage)
+    {
+        List<WmPackage> list = wmPackageService.selectWmPackageList(wmPackage);
+        ExcelUtil<WmPackage> util = new ExcelUtil<WmPackage>(WmPackage.class);
+        return util.exportExcel( list, "装箱单数据");
+    }
+
+    /**
+     * 获取装箱单详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:package:query')")
+    @GetMapping(value = "/{packageId}")
+    public Response getInfo(@PathVariable("packageId") Long packageId)
+    {
+        return Response.success(wmPackageService.selectWmPackageByPackageId(packageId));
+    }
+
+    /**
+     * 新增装箱单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:package:add')")
+    @Log(title = "装箱单", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmPackage wmPackage)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(wmPackageService.checkPackgeCodeUnique(wmPackage))){
+            throw new CustomException("装箱单编号已存在!");
+        }
+        if(wmPackage.getParentId() !=null){
+            WmPackage parentPackage = wmPackageService.selectWmPackageByPackageId(wmPackage.getParentId());
+            if(StringUtils.isNotNull(parentPackage)){
+                wmPackage.setAncestors(parentPackage.getAncestors()+","+parentPackage.getPackageId());
+            }
+        }
+
+        int ret =wmPackageService.insertWmPackage(wmPackage);
+
+        //装箱单保存成功就自动生成对应的箱条码
+        WmBarcode wmBarcode = new WmBarcode();
+        wmBarcode.setBussinessId(wmPackage.getPackageId());
+        wmBarcode.setBussinessCode(wmPackage.getPackageCode());
+        wmBarcode.setBussinessName(wmPackage.getClientName());
+        wmBarcode.setBarcodeType(UserConstants.BARCODE_TYPE_PACKAGE);//类型设置为箱条码
+        wmBarcode.setBarcodeFormart(UserConstants.QR_CODE);//设置为二维码
+        wmBarcode.setBarcodeContent(""+UserConstants.BARCODE_TYPE_PACKAGE+"-"+wmPackage.getPackageCode());
+        String path =wmBarcodeService.generateBarcode(wmBarcode);
+        wmBarcode.setBarcodeUrl(path);
+        wmBarcode.setCreateBy(getUsername());
+        wmBarcodeService.insertWmBarcode(wmBarcode);
+
+        //将条码的URL更新上去
+        wmPackage.setBarcodeId(wmBarcode.getBarcodeId());
+        wmPackage.setBarcodeContent(wmBarcode.getBarcodeContent());
+        wmPackage.setBarcodeUrl(path);
+        wmPackageService.updateWmPackage(wmPackage);
+        return toResponse(ret);
+    }
+
+    /**
+     * 修改装箱单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:package:edit')")
+    @Log(title = "装箱单", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmPackage wmPackage)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(wmPackageService.checkPackgeCodeUnique(wmPackage))){
+            throw new CustomException("装箱单编号已存在!");
+        }
+        return toResponse(wmPackageService.updateWmPackage(wmPackage));
+    }
+
+    /**
+     * 添加子箱
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:package:edit')")
+    @Log(title = "装箱单", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping("/addsub")
+    public Response addSubPackage(@RequestBody WmPackage wmPackage){
+        //不能添加自己
+        if(wmPackage.getPackageId().longValue() == wmPackage.getParentId().longValue()){
+            throw new CustomException("不能添加自己为子箱!");
+        }
+
+        //已经有父箱的不能再次添加
+        WmPackage subPackage = wmPackageService.selectWmPackageByPackageId(wmPackage.getPackageId());
+        if(!"0".equals(subPackage.getAncestors())){
+            throw new CustomException("当前子箱已经有外箱包装!");
+        }
+
+        //更新当前子箱的父箱列表
+        WmPackage parentPackage = wmPackageService.selectWmPackageByPackageId(wmPackage.getParentId());
+        if(StringUtils.isNotNull(parentPackage)){
+            wmPackage.setAncestors(parentPackage.getAncestors()+","+parentPackage.getPackageId());
+        }
+
+        return toResponse(wmPackageService.updateWmPackage(wmPackage));
+    }
+
+
+    /**
+     * 删除装箱单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:package:remove')")
+    @Log(title = "装箱单", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{packageIds}")
+    public Response remove(@PathVariable Long[] packageIds)
+    {
+        return toResponse(wmPackageService.deleteWmPackageByPackageIds(packageIds));
+    }
+}

+ 104 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmPackageLineController.java

@@ -0,0 +1,104 @@
+package com.miaxis.mes.controller.wm;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.wm.domain.WmPackageLine;
+import com.miaxis.mes.wm.service.IWmPackageLineService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 装箱明细Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-10-11
+ */
+@RestController
+@RequestMapping("/mes/wm/packageline")
+public class WmPackageLineController extends BaseController
+{
+    @Autowired
+    private IWmPackageLineService wmPackageLineService;
+
+    /**
+     * 查询装箱明细列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:package:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmPackageLine wmPackageLine)
+    {
+        startPage();
+        List<WmPackageLine> list = wmPackageLineService.selectWmPackageLineList(wmPackageLine);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出装箱明细列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:package:export')")
+    @Log(title = "装箱明细", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmPackageLine wmPackageLine)
+    {
+        List<WmPackageLine> list = wmPackageLineService.selectWmPackageLineList(wmPackageLine);
+        ExcelUtil<WmPackageLine> util = new ExcelUtil<WmPackageLine>(WmPackageLine.class);
+        return util.exportExcel( list, "装箱明细数据");
+    }
+
+    /**
+     * 获取装箱明细详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:package:query')")
+    @GetMapping(value = "/{lineId}")
+    public Response getInfo(@PathVariable("lineId") Long lineId)
+    {
+        return Response.success(wmPackageLineService.selectWmPackageLineByLineId(lineId));
+    }
+
+    /**
+     * 新增装箱明细
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:package:add')")
+    @Log(title = "装箱明细", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmPackageLine wmPackageLine)
+    {
+        return toResponse(wmPackageLineService.insertWmPackageLine(wmPackageLine));
+    }
+
+    /**
+     * 修改装箱明细
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:package:edit')")
+    @Log(title = "装箱明细", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmPackageLine wmPackageLine)
+    {
+        return toResponse(wmPackageLineService.updateWmPackageLine(wmPackageLine));
+    }
+
+    /**
+     * 删除装箱明细
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:package:remove')")
+    @Log(title = "装箱明细", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{lineIds}")
+    public Response remove(@PathVariable Long[] lineIds)
+    {
+        return toResponse(wmPackageLineService.deleteWmPackageLineByLineIds(lineIds));
+    }
+}

+ 114 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmProductProduceController.java

@@ -0,0 +1,114 @@
+package com.miaxis.mes.controller.wm;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.miaxis.mes.wm.service.IWmProductProduceLineService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.wm.domain.WmProductProduce;
+import com.miaxis.mes.wm.service.IWmProductProduceService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 产品产出记录Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-09-21
+ */
+@RestController
+@RequestMapping("/mes/wm/productproduce")
+public class WmProductProduceController extends BaseController
+{
+    @Autowired
+    private IWmProductProduceService wmProductProduceService;
+
+    @Autowired
+    private IWmProductProduceLineService wmProductProduceLineService;
+    /**
+     * 查询产品产出记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productproduce:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmProductProduce wmProductProduce)
+    {
+        startPage();
+        List<WmProductProduce> list = wmProductProduceService.selectWmProductProduceList(wmProductProduce);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出产品产出记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productproduce:export')")
+    @Log(title = "产品产出记录", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmProductProduce wmProductProduce)
+    {
+        List<WmProductProduce> list = wmProductProduceService.selectWmProductProduceList(wmProductProduce);
+        ExcelUtil<WmProductProduce> util = new ExcelUtil<WmProductProduce>(WmProductProduce.class);
+        return util.exportExcel( list, "产品产出记录数据");
+    }
+
+    /**
+     * 获取产品产出记录详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productproduce:query')")
+    @GetMapping(value = "/{recordId}")
+    public Response getInfo(@PathVariable("recordId") Long recordId)
+    {
+        return Response.success(wmProductProduceService.selectWmProductProduceByRecordId(recordId));
+    }
+
+    /**
+     * 新增产品产出记录
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productproduce:add')")
+    @Log(title = "产品产出记录", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmProductProduce wmProductProduce)
+    {
+        return toResponse(wmProductProduceService.insertWmProductProduce(wmProductProduce));
+    }
+
+    /**
+     * 修改产品产出记录
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productproduce:edit')")
+    @Log(title = "产品产出记录", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmProductProduce wmProductProduce)
+    {
+        return toResponse(wmProductProduceService.updateWmProductProduce(wmProductProduce));
+    }
+
+    /**
+     * 删除产品产出记录
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productproduce:remove')")
+    @Log(title = "产品产出记录", businessType = BusinessTypeEnum.DELETE)
+    @Transactional
+	@DeleteMapping("/{recordIds}")
+    public Response remove(@PathVariable Long[] recordIds)
+    {
+        for (Long recordId: recordIds
+             ) {
+            wmProductProduceLineService.deleteByRecordId(recordId);
+        }
+        return toResponse(wmProductProduceService.deleteWmProductProduceByRecordIds(recordIds));
+    }
+}

+ 104 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmProductProduceLineController.java

@@ -0,0 +1,104 @@
+package com.miaxis.mes.controller.wm;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.wm.domain.WmProductProduceLine;
+import com.miaxis.mes.wm.service.IWmProductProduceLineService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 产品产出记录行Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-09-22
+ */
+@RestController
+@RequestMapping("/mes/wm/productproduceline")
+public class WmProductProduceLineController extends BaseController
+{
+    @Autowired
+    private IWmProductProduceLineService wmProductProduceLineService;
+
+    /**
+     * 查询产品产出记录行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productproduce:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmProductProduceLine wmProductProduceLine)
+    {
+        startPage();
+        List<WmProductProduceLine> list = wmProductProduceLineService.selectWmProductProduceLineList(wmProductProduceLine);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出产品产出记录行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productproduce:export')")
+    @Log(title = "产品产出记录行", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmProductProduceLine wmProductProduceLine)
+    {
+        List<WmProductProduceLine> list = wmProductProduceLineService.selectWmProductProduceLineList(wmProductProduceLine);
+        ExcelUtil<WmProductProduceLine> util = new ExcelUtil<WmProductProduceLine>(WmProductProduceLine.class);
+        return util.exportExcel( list, "产品产出记录行数据");
+    }
+
+    /**
+     * 获取产品产出记录行详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productproduce:query')")
+    @GetMapping(value = "/{lineId}")
+    public Response getInfo(@PathVariable("lineId") Long lineId)
+    {
+        return Response.success(wmProductProduceLineService.selectWmProductProduceLineByLineId(lineId));
+    }
+
+    /**
+     * 新增产品产出记录行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productproduce:add')")
+    @Log(title = "产品产出记录行", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmProductProduceLine wmProductProduceLine)
+    {
+        return toResponse(wmProductProduceLineService.insertWmProductProduceLine(wmProductProduceLine));
+    }
+
+    /**
+     * 修改产品产出记录行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productproduce:edit')")
+    @Log(title = "产品产出记录行", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmProductProduceLine wmProductProduceLine)
+    {
+        return toResponse(wmProductProduceLineService.updateWmProductProduceLine(wmProductProduceLine));
+    }
+
+    /**
+     * 删除产品产出记录行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productproduce:remove')")
+    @Log(title = "产品产出记录行", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{lineIds}")
+    public Response remove(@PathVariable Long[] lineIds)
+    {
+        return toResponse(wmProductProduceLineService.deleteWmProductProduceLineByLineIds(lineIds));
+    }
+}

+ 201 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmProductRecptController.java

@@ -0,0 +1,201 @@
+package com.miaxis.mes.controller.wm;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import cn.hutool.core.collection.CollUtil;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.mes.wm.domain.*;
+import com.miaxis.mes.wm.domain.*;
+import com.miaxis.mes.wm.domain.tx.ProductRecptTxBean;
+import com.miaxis.mes.wm.service.*;
+import com.miaxis.mes.wm.service.*;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 产品入库录Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-09-22
+ */
+@RestController
+@RequestMapping("/mes/wm/productrecpt")
+public class WmProductRecptController extends BaseController
+{
+    @Autowired
+    private IWmProductRecptService wmProductRecptService;
+
+    @Autowired
+    private IWmProductRecptLineService wmProductRecptLineService;
+
+    @Autowired
+    private IWmWarehouseService wmWarehouseService;
+
+    @Autowired
+    private IWmStorageLocationService wmStorageLocationService;
+
+    @Autowired
+    private IWmStorageAreaService wmStorageAreaService;
+
+    @Autowired
+    private IStorageCoreService storageCoreService;
+
+    /**
+     * 查询产品入库录列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmProductRecpt wmProductRecpt)
+    {
+        startPage();
+        List<WmProductRecpt> list = wmProductRecptService.selectWmProductRecptList(wmProductRecpt);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出产品入库录列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:export')")
+    @Log(title = "产品入库记录", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmProductRecpt wmProductRecpt)
+    {
+        List<WmProductRecpt> list = wmProductRecptService.selectWmProductRecptList(wmProductRecpt);
+        ExcelUtil<WmProductRecpt> util = new ExcelUtil<WmProductRecpt>(WmProductRecpt.class);
+        return util.exportExcel( list, "产品入库录数据");
+    }
+
+    /**
+     * 获取产品入库录详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:query')")
+    @GetMapping(value = "/{recptId}")
+    public Response getInfo(@PathVariable("recptId") Long recptId)
+    {
+        return Response.success(wmProductRecptService.selectWmProductRecptByRecptId(recptId));
+    }
+
+    /**
+     * 新增产品入库录
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:add')")
+    @Log(title = "产品入库记录", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmProductRecpt wmProductRecpt)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(wmProductRecptService.checkUnique(wmProductRecpt))){
+            throw new CustomException("入库单编号已存在!");
+        }
+
+        if(StringUtils.isNotNull(wmProductRecpt.getWarehouseId())){
+            WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmProductRecpt.getWarehouseId());
+            wmProductRecpt.setWarehouseCode(warehouse.getWarehouseCode());
+            wmProductRecpt.setWarehouseName(warehouse.getWarehouseName());
+        }
+        if(StringUtils.isNotNull(wmProductRecpt.getLocationId())){
+            WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmProductRecpt.getLocationId());
+            wmProductRecpt.setLocationCode(location.getLocationCode());
+            wmProductRecpt.setLocationName(location.getLocationName());
+        }
+        if(StringUtils.isNotNull(wmProductRecpt.getAreaId())){
+            WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmProductRecpt.getAreaId());
+            wmProductRecpt.setAreaCode(area.getAreaCode());
+            wmProductRecpt.setAreaName(area.getAreaName());
+        }
+        wmProductRecpt.setCreateBy(getUsername());
+        return toResponse(wmProductRecptService.insertWmProductRecpt(wmProductRecpt));
+    }
+
+    /**
+     * 修改产品入库录
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:edit')")
+    @Log(title = "产品入库记录", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmProductRecpt wmProductRecpt)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(wmProductRecptService.checkUnique(wmProductRecpt))){
+            throw new CustomException("入库单编号已存在!");
+        }
+
+
+        if(StringUtils.isNotNull(wmProductRecpt.getWarehouseId())){
+            WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmProductRecpt.getWarehouseId());
+            wmProductRecpt.setWarehouseCode(warehouse.getWarehouseCode());
+            wmProductRecpt.setWarehouseName(warehouse.getWarehouseName());
+        }
+        if(StringUtils.isNotNull(wmProductRecpt.getLocationId())){
+            WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmProductRecpt.getLocationId());
+            wmProductRecpt.setLocationCode(location.getLocationCode());
+            wmProductRecpt.setLocationName(location.getLocationName());
+        }
+        if(StringUtils.isNotNull(wmProductRecpt.getAreaId())){
+            WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmProductRecpt.getAreaId());
+            wmProductRecpt.setAreaCode(area.getAreaCode());
+            wmProductRecpt.setAreaName(area.getAreaName());
+        }
+
+        return toResponse(wmProductRecptService.updateWmProductRecpt(wmProductRecpt));
+    }
+
+    /**
+     * 删除产品入库录
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:remove')")
+    @Log(title = "产品入库记录", businessType = BusinessTypeEnum.DELETE)
+    @Transactional
+	@DeleteMapping("/{recptIds}")
+    public Response remove(@PathVariable Long[] recptIds)
+    {
+        for (Long recptId: recptIds
+             ) {
+            wmProductRecptLineService.deleteByRecptId(recptId);
+        }
+        return toResponse(wmProductRecptService.deleteWmProductRecptByRecptIds(recptIds));
+    }
+
+    /**
+     * 执行入库
+     * @return
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:edit')")
+    @Log(title = "产品入库记录", businessType = BusinessTypeEnum.UPDATE)
+    @Transactional
+    @PutMapping("/{recptId}")
+    public Response execute(@PathVariable Long recptId){
+        WmProductRecpt recpt = wmProductRecptService.selectWmProductRecptByRecptId(recptId);
+
+        WmProductRecptLine param = new WmProductRecptLine();
+        param.setRecptId(recptId);
+        List<WmProductRecptLine> lines = wmProductRecptLineService.selectWmProductRecptLineList(param);
+        if(CollUtil.isEmpty(lines)){
+            throw new CustomException("请添加要入库的产品");
+        }
+
+        List<ProductRecptTxBean> beans = wmProductRecptService.getTxBean(recptId);
+        storageCoreService.processProductRecpt(beans);
+
+        recpt.setStatus(UserConstants.ORDER_STATUS_FINISHED);
+        wmProductRecptService.updateWmProductRecpt(recpt);
+
+        return Response.success();
+    }
+
+}

+ 152 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmProductRecptLineController.java

@@ -0,0 +1,152 @@
+package com.miaxis.mes.controller.wm;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.mes.wm.domain.WmStorageArea;
+import com.miaxis.mes.wm.domain.WmStorageLocation;
+import com.miaxis.mes.wm.domain.WmWarehouse;
+import com.miaxis.mes.wm.service.IWmStorageAreaService;
+import com.miaxis.mes.wm.service.IWmStorageLocationService;
+import com.miaxis.mes.wm.service.IWmWarehouseService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.wm.domain.WmProductRecptLine;
+import com.miaxis.mes.wm.service.IWmProductRecptLineService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 产品入库记录行Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-09-22
+ */
+@RestController
+@RequestMapping("/mes/wm/productrecptline")
+public class WmProductRecptLineController extends BaseController
+{
+    @Autowired
+    private IWmProductRecptLineService wmProductRecptLineService;
+
+    @Autowired
+    private IWmWarehouseService wmWarehouseService;
+
+    @Autowired
+    private IWmStorageLocationService wmStorageLocationService;
+
+    @Autowired
+    private IWmStorageAreaService wmStorageAreaService;
+
+    /**
+     * 查询产品入库记录行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmProductRecptLine wmProductRecptLine)
+    {
+        startPage();
+        List<WmProductRecptLine> list = wmProductRecptLineService.selectWmProductRecptLineList(wmProductRecptLine);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出产品入库记录行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:export')")
+    @Log(title = "产品入库记录行", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmProductRecptLine wmProductRecptLine)
+    {
+        List<WmProductRecptLine> list = wmProductRecptLineService.selectWmProductRecptLineList(wmProductRecptLine);
+        ExcelUtil<WmProductRecptLine> util = new ExcelUtil<WmProductRecptLine>(WmProductRecptLine.class);
+        return util.exportExcel( list, "产品入库记录行数据");
+    }
+
+    /**
+     * 获取产品入库记录行详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:query')")
+    @GetMapping(value = "/{lineId}")
+    public Response getInfo(@PathVariable("lineId") Long lineId)
+    {
+        return Response.success(wmProductRecptLineService.selectWmProductRecptLineByLineId(lineId));
+    }
+
+    /**
+     * 新增产品入库记录行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:add')")
+    @Log(title = "产品入库记录行", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmProductRecptLine wmProductRecptLine)
+    {
+        if(StringUtils.isNotNull(wmProductRecptLine.getWarehouseId())){
+            WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmProductRecptLine.getWarehouseId());
+            wmProductRecptLine.setWarehouseCode(warehouse.getWarehouseCode());
+            wmProductRecptLine.setWarehouseName(warehouse.getWarehouseName());
+        }
+        if(StringUtils.isNotNull(wmProductRecptLine.getLocationId())){
+            WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmProductRecptLine.getLocationId());
+            wmProductRecptLine.setLocationCode(location.getLocationCode());
+            wmProductRecptLine.setLocationName(location.getLocationName());
+        }
+        if(StringUtils.isNotNull(wmProductRecptLine.getAreaId())){
+            WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmProductRecptLine.getAreaId());
+            wmProductRecptLine.setAreaCode(area.getAreaCode());
+            wmProductRecptLine.setAreaName(area.getAreaName());
+        }
+        wmProductRecptLine.setCreateBy(getUsername());
+        return toResponse(wmProductRecptLineService.insertWmProductRecptLine(wmProductRecptLine));
+    }
+
+    /**
+     * 修改产品入库记录行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:edit')")
+    @Log(title = "产品入库记录行", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmProductRecptLine wmProductRecptLine)
+    {
+        if(StringUtils.isNotNull(wmProductRecptLine.getWarehouseId())){
+            WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmProductRecptLine.getWarehouseId());
+            wmProductRecptLine.setWarehouseCode(warehouse.getWarehouseCode());
+            wmProductRecptLine.setWarehouseName(warehouse.getWarehouseName());
+        }
+        if(StringUtils.isNotNull(wmProductRecptLine.getLocationId())){
+            WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmProductRecptLine.getLocationId());
+            wmProductRecptLine.setLocationCode(location.getLocationCode());
+            wmProductRecptLine.setLocationName(location.getLocationName());
+        }
+        if(StringUtils.isNotNull(wmProductRecptLine.getAreaId())){
+            WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmProductRecptLine.getAreaId());
+            wmProductRecptLine.setAreaCode(area.getAreaCode());
+            wmProductRecptLine.setAreaName(area.getAreaName());
+        }
+        return toResponse(wmProductRecptLineService.updateWmProductRecptLine(wmProductRecptLine));
+    }
+
+    /**
+     * 删除产品入库记录行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:remove')")
+    @Log(title = "产品入库记录行", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{lineIds}")
+    public Response remove(@PathVariable Long[] lineIds)
+    {
+        return toResponse(wmProductRecptLineService.deleteWmProductRecptLineByLineIds(lineIds));
+    }
+}

+ 187 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmProductSalseController.java

@@ -0,0 +1,187 @@
+package com.miaxis.mes.controller.wm;
+
+import cn.hutool.core.collection.CollectionUtil;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.wm.domain.*;
+import com.miaxis.mes.wm.domain.tx.ProductSalseTxBean;
+import com.miaxis.mes.wm.service.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 销售出库单Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-10-04
+ */
+@RestController
+@RequestMapping("/mes/wm/productsalse")
+public class WmProductSalseController extends BaseController
+{
+    @Autowired
+    private IWmProductSalseService wmProductSalseService;
+
+    @Autowired
+    private IWmProductSalseLineService wmProductSalseLineService;
+
+    @Autowired
+    private IWmWarehouseService wmWarehouseService;
+
+    @Autowired
+    private IWmStorageLocationService wmStorageLocationService;
+
+    @Autowired
+    private IWmStorageAreaService wmStorageAreaService;
+
+    @Autowired
+    private IStorageCoreService storageCoreService;
+
+    /**
+     * 查询销售出库单列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmProductSalse wmProductSalse)
+    {
+        startPage();
+        List<WmProductSalse> list = wmProductSalseService.selectWmProductSalseList(wmProductSalse);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出销售出库单列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:export')")
+    @Log(title = "销售出库单", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmProductSalse wmProductSalse)
+    {
+        List<WmProductSalse> list = wmProductSalseService.selectWmProductSalseList(wmProductSalse);
+        ExcelUtil<WmProductSalse> util = new ExcelUtil<WmProductSalse>(WmProductSalse.class);
+        return util.exportExcel( list, "销售出库单数据");
+    }
+
+    /**
+     * 获取销售出库单详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:query')")
+    @GetMapping(value = "/{salseId}")
+    public Response getInfo(@PathVariable("salseId") Long salseId)
+    {
+        return Response.success(wmProductSalseService.selectWmProductSalseBySalseId(salseId));
+    }
+
+    /**
+     * 新增销售出库单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:add')")
+    @Log(title = "销售出库单", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmProductSalse wmProductSalse)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(wmProductSalseService.checkUnique(wmProductSalse))){
+            throw new CustomException("出库单编号已存在!");
+        }
+        if(StringUtils.isNotNull(wmProductSalse.getWarehouseId())){
+            WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmProductSalse.getWarehouseId());
+            wmProductSalse.setWarehouseCode(warehouse.getWarehouseCode());
+            wmProductSalse.setWarehouseName(warehouse.getWarehouseName());
+        }
+        if(StringUtils.isNotNull(wmProductSalse.getLocationId())){
+            WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmProductSalse.getLocationId());
+            wmProductSalse.setLocationCode(location.getLocationCode());
+            wmProductSalse.setLocationName(location.getLocationName());
+        }
+        if(StringUtils.isNotNull(wmProductSalse.getAreaId())){
+            WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmProductSalse.getAreaId());
+            wmProductSalse.setAreaCode(area.getAreaCode());
+            wmProductSalse.setAreaName(area.getAreaName());
+        }
+        wmProductSalse.setCreateBy(getUsername());
+        return toResponse(wmProductSalseService.insertWmProductSalse(wmProductSalse));
+    }
+
+    /**
+     * 修改销售出库单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:edit')")
+    @Log(title = "销售出库单", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmProductSalse wmProductSalse)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(wmProductSalseService.checkUnique(wmProductSalse))){
+            throw new CustomException("出库单编号已存在!");
+        }
+        if(StringUtils.isNotNull(wmProductSalse.getWarehouseId())){
+            WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmProductSalse.getWarehouseId());
+            wmProductSalse.setWarehouseCode(warehouse.getWarehouseCode());
+            wmProductSalse.setWarehouseName(warehouse.getWarehouseName());
+        }
+        if(StringUtils.isNotNull(wmProductSalse.getLocationId())){
+            WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmProductSalse.getLocationId());
+            wmProductSalse.setLocationCode(location.getLocationCode());
+            wmProductSalse.setLocationName(location.getLocationName());
+        }
+        if(StringUtils.isNotNull(wmProductSalse.getAreaId())){
+            WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmProductSalse.getAreaId());
+            wmProductSalse.setAreaCode(area.getAreaCode());
+            wmProductSalse.setAreaName(area.getAreaName());
+        }
+        return toResponse(wmProductSalseService.updateWmProductSalse(wmProductSalse));
+    }
+
+    /**
+     * 删除销售出库单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:remove')")
+    @Log(title = "销售出库单", businessType = BusinessTypeEnum.DELETE)
+    @Transactional
+	@DeleteMapping("/{salseIds}")
+    public Response remove(@PathVariable Long[] salseIds)
+    {
+        for (Long salseId: salseIds
+             ) {
+            wmProductSalseLineService.deleteBySalseId(salseId);
+        }
+        return toResponse(wmProductSalseService.deleteWmProductSalseBySalseIds(salseIds));
+    }
+
+    /**
+     * 执行出库
+     * @return
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:edit')")
+    @Log(title = "销售出库单", businessType = BusinessTypeEnum.UPDATE)
+    @Transactional
+    @PutMapping("/{salseId}")
+    public Response execute(@PathVariable Long salseId){
+        WmProductSalse salse = wmProductSalseService.selectWmProductSalseBySalseId(salseId);
+
+        WmProductSalseLine param = new WmProductSalseLine();
+        param.setSalseId(salseId);
+        List<WmProductSalseLine> lines = wmProductSalseLineService.selectWmProductSalseLineList(param);
+        if(CollectionUtil.isEmpty(lines)){
+            throw new CustomException("出库物资不能为空");
+        }
+
+        List<ProductSalseTxBean> beans = wmProductSalseService.getTxBeans(salseId);
+        storageCoreService.processProductSalse(beans);
+
+        salse.setStatus(UserConstants.ORDER_STATUS_FINISHED);
+        wmProductSalseService.updateWmProductSalse(salse);
+        return Response.success();
+    }
+}

+ 105 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmProductSalseLineController.java

@@ -0,0 +1,105 @@
+package com.miaxis.mes.controller.wm;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.wm.domain.WmProductSalseLine;
+import com.miaxis.mes.wm.service.IWmProductSalseLineService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 产品销售出库行Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-10-05
+ */
+@RestController
+@RequestMapping("/mes/wm/productsalseline")
+public class WmProductSalseLineController extends BaseController
+{
+    @Autowired
+    private IWmProductSalseLineService wmProductSalseLineService;
+
+    /**
+     * 查询产品销售出库行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmProductSalseLine wmProductSalseLine)
+    {
+        startPage();
+        List<WmProductSalseLine> list = wmProductSalseLineService.selectWmProductSalseLineList(wmProductSalseLine);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出产品销售出库行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:export')")
+    @Log(title = "产品销售出库行", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmProductSalseLine wmProductSalseLine)
+    {
+        List<WmProductSalseLine> list = wmProductSalseLineService.selectWmProductSalseLineList(wmProductSalseLine);
+        ExcelUtil<WmProductSalseLine> util = new ExcelUtil<WmProductSalseLine>(WmProductSalseLine.class);
+        return util.exportExcel( list, "产品销售出库行数据");
+    }
+
+    /**
+     * 获取产品销售出库行详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:query')")
+    @GetMapping(value = "/{lineId}")
+    public Response getInfo(@PathVariable("lineId") Long lineId)
+    {
+        return Response.success(wmProductSalseLineService.selectWmProductSalseLineByLineId(lineId));
+    }
+
+    /**
+     * 新增产品销售出库行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:add')")
+    @Log(title = "产品销售出库行", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmProductSalseLine wmProductSalseLine)
+    {
+        wmProductSalseLine.setCreateBy(getUsername());
+        return toResponse(wmProductSalseLineService.insertWmProductSalseLine(wmProductSalseLine));
+    }
+
+    /**
+     * 修改产品销售出库行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:edit')")
+    @Log(title = "产品销售出库行", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmProductSalseLine wmProductSalseLine)
+    {
+        return toResponse(wmProductSalseLineService.updateWmProductSalseLine(wmProductSalseLine));
+    }
+
+    /**
+     * 删除产品销售出库行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:remove')")
+    @Log(title = "产品销售出库行", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{lineIds}")
+    public Response remove(@PathVariable Long[] lineIds)
+    {
+        return toResponse(wmProductSalseLineService.deleteWmProductSalseLineByLineIds(lineIds));
+    }
+}

+ 194 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmRtIssueController.java

@@ -0,0 +1,194 @@
+package com.miaxis.mes.controller.wm;
+
+import cn.hutool.core.collection.CollUtil;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.wm.domain.*;
+import com.miaxis.mes.wm.domain.tx.RtIssueTxBean;
+import com.miaxis.mes.wm.service.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 生产退料单头Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-09-15
+ */
+@RestController
+@RequestMapping("/mes/wm/rtissue")
+public class WmRtIssueController extends BaseController
+{
+    @Autowired
+    private IWmRtIssueService wmRtIssueService;
+
+    @Autowired
+    private IWmRtIssueLineService wmRtIssueLineService;
+
+
+    @Autowired
+    private IWmWarehouseService wmWarehouseService;
+
+    @Autowired
+    private IWmStorageLocationService wmStorageLocationService;
+
+    @Autowired
+    private IWmStorageAreaService wmStorageAreaService;
+
+    @Autowired
+    private IStorageCoreService storageCoreService;
+
+    /**
+     * 查询生产退料单头列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmRtIssue wmRtIssue)
+    {
+        startPage();
+        List<WmRtIssue> list = wmRtIssueService.selectWmRtIssueList(wmRtIssue);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出生产退料单头列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:export')")
+    @Log(title = "生产退料单头", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmRtIssue wmRtIssue)
+    {
+        List<WmRtIssue> list = wmRtIssueService.selectWmRtIssueList(wmRtIssue);
+        ExcelUtil<WmRtIssue> util = new ExcelUtil<WmRtIssue>(WmRtIssue.class);
+        return util.exportExcel( list, "生产退料单头数据");
+    }
+
+    /**
+     * 获取生产退料单头详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:query')")
+    @GetMapping(value = "/{rtId}")
+    public Response getInfo(@PathVariable("rtId") Long rtId)
+    {
+        return Response.success(wmRtIssueService.selectWmRtIssueByRtId(rtId));
+    }
+
+    /**
+     * 新增生产退料单头
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:add')")
+    @Log(title = "生产退料单头", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmRtIssue wmRtIssue)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(wmRtIssueService.checkUnique(wmRtIssue))){
+            throw new CustomException("退料单编号已存在");
+        }
+
+        if(StringUtils.isNotNull(wmRtIssue.getWarehouseId())){
+            WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmRtIssue.getWarehouseId());
+            wmRtIssue.setWarehouseCode(warehouse.getWarehouseCode());
+            wmRtIssue.setWarehouseName(warehouse.getWarehouseName());
+        }
+        if(StringUtils.isNotNull(wmRtIssue.getLocationId())){
+            WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmRtIssue.getLocationId());
+            wmRtIssue.setLocationCode(location.getLocationCode());
+            wmRtIssue.setLocationName(location.getLocationName());
+        }
+        if(StringUtils.isNotNull(wmRtIssue.getAreaId())){
+            WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmRtIssue.getAreaId());
+            wmRtIssue.setAreaCode(area.getAreaCode());
+            wmRtIssue.setAreaName(area.getAreaName());
+        }
+        wmRtIssue.setCreateBy(getUsername());
+        return toResponse(wmRtIssueService.insertWmRtIssue(wmRtIssue));
+    }
+
+    /**
+     * 修改生产退料单头
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:edit')")
+    @Log(title = "生产退料单头", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmRtIssue wmRtIssue)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(wmRtIssueService.checkUnique(wmRtIssue))){
+            throw new CustomException("退料单编号已存在");
+        }
+
+        if(StringUtils.isNotNull(wmRtIssue.getWarehouseId())){
+            WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmRtIssue.getWarehouseId());
+            wmRtIssue.setWarehouseCode(warehouse.getWarehouseCode());
+            wmRtIssue.setWarehouseName(warehouse.getWarehouseName());
+        }
+        if(StringUtils.isNotNull(wmRtIssue.getLocationId())){
+            WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmRtIssue.getLocationId());
+            wmRtIssue.setLocationCode(location.getLocationCode());
+            wmRtIssue.setLocationName(location.getLocationName());
+        }
+        if(StringUtils.isNotNull(wmRtIssue.getAreaId())){
+            WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmRtIssue.getAreaId());
+            wmRtIssue.setAreaCode(area.getAreaCode());
+            wmRtIssue.setAreaName(area.getAreaName());
+        }
+        return toResponse(wmRtIssueService.updateWmRtIssue(wmRtIssue));
+    }
+
+    /**
+     * 删除生产退料单头
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:remove')")
+    @Log(title = "生产退料单头", businessType = BusinessTypeEnum.DELETE)
+    @Transactional
+	@DeleteMapping("/{rtIds}")
+    public Response remove(@PathVariable Long[] rtIds)
+    {
+        for (Long rtId: rtIds
+        ) {
+            wmRtIssueLineService.deleteByRtId(rtId);
+        }
+        return toResponse(wmRtIssueService.deleteWmRtIssueByRtIds(rtIds));
+    }
+
+    /**
+     * 执行退料
+     * @param rtId
+     * @return
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:edit')")
+    @Log(title = "生产退料单头", businessType = BusinessTypeEnum.UPDATE)
+    @Transactional
+    @PutMapping("/{rtId}")
+    public Response execute(@PathVariable Long rtId){
+        WmRtIssue rtIssue = wmRtIssueService.selectWmRtIssueByRtId(rtId);
+        WmRtIssueLine param = new WmRtIssueLine();
+        param.setRtId(rtId);
+        List<WmRtIssueLine> lines = wmRtIssueLineService.selectWmRtIssueLineList(param);
+        if(CollUtil.isEmpty(lines)){
+            throw new CustomException("请选择要退料的物资");
+        }
+
+        List<RtIssueTxBean> beans = wmRtIssueService.getTxBeans(rtId);
+
+        //执行生产退料
+        storageCoreService.processRtIssue(beans);
+
+
+        rtIssue.setStatus(UserConstants.ORDER_STATUS_FINISHED);
+        wmRtIssueService.updateWmRtIssue(rtIssue);
+        return Response.success();
+    }
+
+}

+ 156 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmRtIssueLineController.java

@@ -0,0 +1,156 @@
+package com.miaxis.mes.controller.wm;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.mes.wm.domain.WmStorageArea;
+import com.miaxis.mes.wm.domain.WmStorageLocation;
+import com.miaxis.mes.wm.domain.WmWarehouse;
+import com.miaxis.mes.wm.service.IWmStorageAreaService;
+import com.miaxis.mes.wm.service.IWmStorageLocationService;
+import com.miaxis.mes.wm.service.IWmWarehouseService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.wm.domain.WmRtIssueLine;
+import com.miaxis.mes.wm.service.IWmRtIssueLineService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 生产退料单行Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-09-15
+ */
+@RestController
+@RequestMapping("/mes/wm/rtissueline")
+public class WmRtIssueLineController extends BaseController
+{
+    @Autowired
+    private IWmRtIssueLineService wmRtIssueLineService;
+
+    @Autowired
+    private IWmWarehouseService wmWarehouseService;
+
+    @Autowired
+    private IWmStorageLocationService wmStorageLocationService;
+
+    @Autowired
+    private IWmStorageAreaService wmStorageAreaService;
+
+    /**
+     * 查询生产退料单行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmRtIssueLine wmRtIssueLine)
+    {
+        startPage();
+        List<WmRtIssueLine> list = wmRtIssueLineService.selectWmRtIssueLineList(wmRtIssueLine);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出生产退料单行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:export')")
+    @Log(title = "生产退料单行", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmRtIssueLine wmRtIssueLine)
+    {
+        List<WmRtIssueLine> list = wmRtIssueLineService.selectWmRtIssueLineList(wmRtIssueLine);
+        ExcelUtil<WmRtIssueLine> util = new ExcelUtil<WmRtIssueLine>(WmRtIssueLine.class);
+        return util.exportExcel( list, "生产退料单行数据");
+    }
+
+    /**
+     * 获取生产退料单行详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:query')")
+    @GetMapping(value = "/{lineId}")
+    public Response getInfo(@PathVariable("lineId") Long lineId)
+    {
+        return Response.success(wmRtIssueLineService.selectWmRtIssueLineByLineId(lineId));
+    }
+
+    /**
+     * 新增生产退料单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:add')")
+    @Log(title = "生产退料单行", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmRtIssueLine wmRtIssueLine)
+    {
+        if(!StringUtils.isNotNull(wmRtIssueLine.getMaterialStockId())){
+            throw new CustomException("请从库存现有量中选择退料的物资!");
+        }
+
+        if(StringUtils.isNotNull(wmRtIssueLine.getWarehouseId())){
+            WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmRtIssueLine.getWarehouseId());
+            wmRtIssueLine.setWarehouseCode(warehouse.getWarehouseCode());
+            wmRtIssueLine.setWarehouseName(warehouse.getWarehouseName());
+        }
+        if(StringUtils.isNotNull(wmRtIssueLine.getLocationId())){
+            WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmRtIssueLine.getLocationId());
+            wmRtIssueLine.setLocationCode(location.getLocationCode());
+            wmRtIssueLine.setLocationName(location.getLocationName());
+        }
+        if(StringUtils.isNotNull(wmRtIssueLine.getAreaId())){
+            WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmRtIssueLine.getAreaId());
+            wmRtIssueLine.setAreaCode(area.getAreaCode());
+            wmRtIssueLine.setAreaName(area.getAreaName());
+        }
+        wmRtIssueLine.setCreateBy(getUsername());
+        return toResponse(wmRtIssueLineService.insertWmRtIssueLine(wmRtIssueLine));
+    }
+
+    /**
+     * 修改生产退料单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:edit')")
+    @Log(title = "生产退料单行", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmRtIssueLine wmRtIssueLine)
+    {
+        if(StringUtils.isNotNull(wmRtIssueLine.getWarehouseId())){
+            WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmRtIssueLine.getWarehouseId());
+            wmRtIssueLine.setWarehouseCode(warehouse.getWarehouseCode());
+            wmRtIssueLine.setWarehouseName(warehouse.getWarehouseName());
+        }
+        if(StringUtils.isNotNull(wmRtIssueLine.getLocationId())){
+            WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmRtIssueLine.getLocationId());
+            wmRtIssueLine.setLocationCode(location.getLocationCode());
+            wmRtIssueLine.setLocationName(location.getLocationName());
+        }
+        if(StringUtils.isNotNull(wmRtIssueLine.getAreaId())){
+            WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmRtIssueLine.getAreaId());
+            wmRtIssueLine.setAreaCode(area.getAreaCode());
+            wmRtIssueLine.setAreaName(area.getAreaName());
+        }
+        return toResponse(wmRtIssueLineService.updateWmRtIssueLine(wmRtIssueLine));
+    }
+
+    /**
+     * 删除生产退料单行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:remove')")
+    @Log(title = "生产退料单行", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{lineIds}")
+    public Response remove(@PathVariable Long[] lineIds)
+    {
+        return toResponse(wmRtIssueLineService.deleteWmRtIssueLineByLineIds(lineIds));
+    }
+}

+ 200 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmRtSalseController.java

@@ -0,0 +1,200 @@
+package com.miaxis.mes.controller.wm;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.mes.wm.domain.*;
+import com.miaxis.mes.wm.domain.*;
+import com.miaxis.mes.wm.domain.tx.RtSalseTxBean;
+import com.miaxis.mes.wm.service.*;
+import com.miaxis.mes.wm.service.*;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 产品销售退货单Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-10-06
+ */
+@RestController
+@RequestMapping("/mes/wm/rtsalse")
+public class WmRtSalseController extends BaseController
+{
+    @Autowired
+    private IWmRtSalseService wmRtSalseService;
+
+    @Autowired
+    private IWmRtSalseLineService wmRtSalseLineService;
+
+    @Autowired
+    private IWmWarehouseService wmWarehouseService;
+
+    @Autowired
+    private IWmStorageLocationService wmStorageLocationService;
+
+    @Autowired
+    private IWmStorageAreaService wmStorageAreaService;
+
+    @Autowired
+    private IStorageCoreService storageCoreService;
+
+    /**
+     * 查询产品销售退货单列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmRtSalse wmRtSalse)
+    {
+        startPage();
+        List<WmRtSalse> list = wmRtSalseService.selectWmRtSalseList(wmRtSalse);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出产品销售退货单列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:export')")
+    @Log(title = "产品销售退货单", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmRtSalse wmRtSalse)
+    {
+        List<WmRtSalse> list = wmRtSalseService.selectWmRtSalseList(wmRtSalse);
+        ExcelUtil<WmRtSalse> util = new ExcelUtil<WmRtSalse>(WmRtSalse.class);
+        return util.exportExcel( list, "产品销售退货单数据");
+    }
+
+    /**
+     * 获取产品销售退货单详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:query')")
+    @GetMapping(value = "/{rtId}")
+    public Response getInfo(@PathVariable("rtId") Long rtId)
+    {
+        return Response.success(wmRtSalseService.selectWmRtSalseByRtId(rtId));
+    }
+
+    /**
+     * 新增产品销售退货单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:add')")
+    @Log(title = "产品销售退货单", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmRtSalse wmRtSalse)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(wmRtSalseService.checkUnique(wmRtSalse))){
+            throw new CustomException("退货单号已存在!");
+        }
+
+        if(StringUtils.isNotNull(wmRtSalse.getWarehouseId())){
+            WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmRtSalse.getWarehouseId());
+            wmRtSalse.setWarehouseCode(warehouse.getWarehouseCode());
+            wmRtSalse.setWarehouseName(warehouse.getWarehouseName());
+        }
+        if(StringUtils.isNotNull(wmRtSalse.getLocationId())){
+            WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmRtSalse.getLocationId());
+            wmRtSalse.setLocationCode(location.getLocationCode());
+            wmRtSalse.setLocationName(location.getLocationName());
+        }
+        if(StringUtils.isNotNull(wmRtSalse.getAreaId())){
+            WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmRtSalse.getAreaId());
+            wmRtSalse.setAreaCode(area.getAreaCode());
+            wmRtSalse.setAreaName(area.getAreaName());
+        }
+        wmRtSalse.setCreateBy(getUsername());
+        return toResponse(wmRtSalseService.insertWmRtSalse(wmRtSalse));
+    }
+
+    /**
+     * 修改产品销售退货单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:edit')")
+    @Log(title = "产品销售退货单", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmRtSalse wmRtSalse)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(wmRtSalseService.checkUnique(wmRtSalse))){
+            throw new CustomException("退货单号已存在!");
+        }
+
+        if(StringUtils.isNotNull(wmRtSalse.getWarehouseId())){
+            WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmRtSalse.getWarehouseId());
+            wmRtSalse.setWarehouseCode(warehouse.getWarehouseCode());
+            wmRtSalse.setWarehouseName(warehouse.getWarehouseName());
+        }
+        if(StringUtils.isNotNull(wmRtSalse.getLocationId())){
+            WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmRtSalse.getLocationId());
+            wmRtSalse.setLocationCode(location.getLocationCode());
+            wmRtSalse.setLocationName(location.getLocationName());
+        }
+        if(StringUtils.isNotNull(wmRtSalse.getAreaId())){
+            WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmRtSalse.getAreaId());
+            wmRtSalse.setAreaCode(area.getAreaCode());
+            wmRtSalse.setAreaName(area.getAreaName());
+        }
+        return toResponse(wmRtSalseService.updateWmRtSalse(wmRtSalse));
+    }
+
+    /**
+     * 删除产品销售退货单
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:remove')")
+    @Log(title = "产品销售退货单", businessType = BusinessTypeEnum.DELETE)
+    @Transactional
+	@DeleteMapping("/{rtIds}")
+    public Response remove(@PathVariable Long[] rtIds)
+    {
+        for (Long rtId: rtIds
+             ) {
+            wmRtSalseLineService.deleteByRtId(rtId);
+        }
+
+        return toResponse(wmRtSalseService.deleteWmRtSalseByRtIds(rtIds));
+    }
+
+    /**
+     * 执行退货
+     * @param rtId
+     * @return
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:edit')")
+    @Log(title = "产品销售退货单", businessType = BusinessTypeEnum.UPDATE)
+    @Transactional
+    @PutMapping("/{rtId}")
+    public Response execute(@PathVariable Long rtId){
+        WmRtSalse rtSalse = wmRtSalseService.selectWmRtSalseByRtId(rtId);
+        WmRtSalseLine param = new WmRtSalseLine();
+        param.setRtId(rtId);
+        List<WmRtSalseLine> lines = wmRtSalseLineService.selectWmRtSalseLineList(param);
+        if(CollectionUtils.isEmpty(lines)){
+            throw new CustomException("请添加退货单行信息!");
+        }
+
+        List<RtSalseTxBean> beans = wmRtSalseService.getTxBeans(rtId);
+
+        storageCoreService.processRtSalse(beans);
+
+        rtSalse.setStatus(UserConstants.ORDER_STATUS_FINISHED);
+        wmRtSalseService.updateWmRtSalse(rtSalse);
+        return Response.success();
+    }
+
+}

+ 152 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmRtSalseLineController.java

@@ -0,0 +1,152 @@
+package com.miaxis.mes.controller.wm;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.mes.wm.domain.WmStorageArea;
+import com.miaxis.mes.wm.domain.WmStorageLocation;
+import com.miaxis.mes.wm.domain.WmWarehouse;
+import com.miaxis.mes.wm.service.IWmStorageAreaService;
+import com.miaxis.mes.wm.service.IWmStorageLocationService;
+import com.miaxis.mes.wm.service.IWmWarehouseService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.wm.domain.WmRtSalseLine;
+import com.miaxis.mes.wm.service.IWmRtSalseLineService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 产品销售退货行Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-10-06
+ */
+@RestController
+@RequestMapping("/mes/wm/rtsalseline")
+public class WmRtSalseLineController extends BaseController
+{
+    @Autowired
+    private IWmRtSalseLineService wmRtSalseLineService;
+
+    @Autowired
+    private IWmWarehouseService wmWarehouseService;
+
+    @Autowired
+    private IWmStorageLocationService wmStorageLocationService;
+
+    @Autowired
+    private IWmStorageAreaService wmStorageAreaService;
+
+    /**
+     * 查询产品销售退货行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmRtSalseLine wmRtSalseLine)
+    {
+        startPage();
+        List<WmRtSalseLine> list = wmRtSalseLineService.selectWmRtSalseLineList(wmRtSalseLine);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出产品销售退货行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:export')")
+    @Log(title = "产品销售退货行", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmRtSalseLine wmRtSalseLine)
+    {
+        List<WmRtSalseLine> list = wmRtSalseLineService.selectWmRtSalseLineList(wmRtSalseLine);
+        ExcelUtil<WmRtSalseLine> util = new ExcelUtil<WmRtSalseLine>(WmRtSalseLine.class);
+        return util.exportExcel( list, "产品销售退货行数据");
+    }
+
+    /**
+     * 获取产品销售退货行详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:query')")
+    @GetMapping(value = "/{lineId}")
+    public Response getInfo(@PathVariable("lineId") Long lineId)
+    {
+        return Response.success(wmRtSalseLineService.selectWmRtSalseLineByLineId(lineId));
+    }
+
+    /**
+     * 新增产品销售退货行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:add')")
+    @Log(title = "产品销售退货行", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmRtSalseLine wmRtSalseLine)
+    {
+        if(StringUtils.isNotNull(wmRtSalseLine.getWarehouseId())){
+            WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmRtSalseLine.getWarehouseId());
+            wmRtSalseLine.setWarehouseCode(warehouse.getWarehouseCode());
+            wmRtSalseLine.setWarehouseName(warehouse.getWarehouseName());
+        }
+        if(StringUtils.isNotNull(wmRtSalseLine.getLocationId())){
+            WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmRtSalseLine.getLocationId());
+            wmRtSalseLine.setLocationCode(location.getLocationCode());
+            wmRtSalseLine.setLocationName(location.getLocationName());
+        }
+        if(StringUtils.isNotNull(wmRtSalseLine.getAreaId())){
+            WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmRtSalseLine.getAreaId());
+            wmRtSalseLine.setAreaCode(area.getAreaCode());
+            wmRtSalseLine.setAreaName(area.getAreaName());
+        }
+        wmRtSalseLine.setCreateBy(getUsername());
+        return toResponse(wmRtSalseLineService.insertWmRtSalseLine(wmRtSalseLine));
+    }
+
+    /**
+     * 修改产品销售退货行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:edit')")
+    @Log(title = "产品销售退货行", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmRtSalseLine wmRtSalseLine)
+    {
+        if(StringUtils.isNotNull(wmRtSalseLine.getWarehouseId())){
+            WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmRtSalseLine.getWarehouseId());
+            wmRtSalseLine.setWarehouseCode(warehouse.getWarehouseCode());
+            wmRtSalseLine.setWarehouseName(warehouse.getWarehouseName());
+        }
+        if(StringUtils.isNotNull(wmRtSalseLine.getLocationId())){
+            WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmRtSalseLine.getLocationId());
+            wmRtSalseLine.setLocationCode(location.getLocationCode());
+            wmRtSalseLine.setLocationName(location.getLocationName());
+        }
+        if(StringUtils.isNotNull(wmRtSalseLine.getAreaId())){
+            WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmRtSalseLine.getAreaId());
+            wmRtSalseLine.setAreaCode(area.getAreaCode());
+            wmRtSalseLine.setAreaName(area.getAreaName());
+        }
+        return toResponse(wmRtSalseLineService.updateWmRtSalseLine(wmRtSalseLine));
+    }
+
+    /**
+     * 删除产品销售退货行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:remove')")
+    @Log(title = "产品销售退货行", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{lineIds}")
+    public Response remove(@PathVariable Long[] lineIds)
+    {
+        return toResponse(wmRtSalseLineService.deleteWmRtSalseLineByLineIds(lineIds));
+    }
+}

+ 159 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmRtVendorController.java

@@ -0,0 +1,159 @@
+package com.miaxis.mes.controller.wm;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.mes.wm.domain.tx.RtVendorTxBean;
+import com.miaxis.mes.wm.service.IStorageCoreService;
+import com.miaxis.mes.wm.service.IWmRtVendorLineService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.wm.domain.WmRtVendor;
+import com.miaxis.mes.wm.service.IWmRtVendorService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 供应商退货Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-06-13
+ */
+@RestController
+@RequestMapping("/mes/wm/rtvendor")
+public class WmRtVendorController extends BaseController
+{
+    @Autowired
+    private IWmRtVendorService wmRtVendorService;
+
+    @Autowired
+    private IWmRtVendorLineService wmRtVendorLineService;
+
+    @Autowired
+    private IStorageCoreService storageCoreService;
+    /**
+     * 查询供应商退货列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmRtVendor wmRtVendor)
+    {
+        startPage();
+        List<WmRtVendor> list = wmRtVendorService.selectWmRtVendorList(wmRtVendor);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出供应商退货列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:export')")
+    @Log(title = "供应商退货", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmRtVendor wmRtVendor)
+    {
+        List<WmRtVendor> list = wmRtVendorService.selectWmRtVendorList(wmRtVendor);
+        ExcelUtil<WmRtVendor> util = new ExcelUtil<WmRtVendor>(WmRtVendor.class);
+        return util.exportExcel( list, "供应商退货数据");
+    }
+
+    /**
+     * 获取供应商退货详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:query')")
+    @GetMapping(value = "/{rtId}")
+    public Response getInfo(@PathVariable("rtId") Long rtId)
+    {
+        return Response.success(wmRtVendorService.selectWmRtVendorByRtId(rtId));
+    }
+
+    /**
+     * 新增供应商退货
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:add')")
+    @Log(title = "供应商退货", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmRtVendor wmRtVendor)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(wmRtVendorService.checkCodeUnique(wmRtVendor))){
+            throw new CustomException("退货单编号已经存在!");
+        }
+        wmRtVendor.setCreateBy(getUsername());
+        return toResponse(wmRtVendorService.insertWmRtVendor(wmRtVendor));
+    }
+
+    /**
+     * 修改供应商退货
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:edit')")
+    @Log(title = "供应商退货", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmRtVendor wmRtVendor)
+    {
+        if(UserConstants.NOT_UNIQUE.equals(wmRtVendorService.checkCodeUnique(wmRtVendor))){
+            throw new CustomException("退货单编号已经存在!");
+        }
+        return toResponse(wmRtVendorService.updateWmRtVendor(wmRtVendor));
+    }
+
+    /**
+     * 删除供应商退货
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:remove')")
+    @Log(title = "供应商退货", businessType = BusinessTypeEnum.DELETE)
+	@Transactional
+    @DeleteMapping("/{rtIds}")
+    public Response remove(@PathVariable Long[] rtIds)
+    {
+        for (Long rtId:rtIds
+             ) {
+            WmRtVendor rtVendor = wmRtVendorService.selectWmRtVendorByRtId(rtId);
+            if(!UserConstants.ORDER_STATUS_PREPARE.equals(rtVendor.getStatus())){
+                throw new CustomException("只能删除草稿状态的单据!");
+            }
+
+            wmRtVendorLineService.deleteByRtId(rtId);
+        }
+        return toResponse(wmRtVendorService.deleteWmRtVendorByRtIds(rtIds));
+    }
+
+    /**
+     * 执行退货
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:edit')")
+    @Log(title = "供应商退货单", businessType = BusinessTypeEnum.UPDATE)
+    @Transactional
+    @PutMapping("/{rtId}")
+    public Response execute(@PathVariable Long rtId){
+        //判断单据状态
+        WmRtVendor wmRtVendor = wmRtVendorService.selectWmRtVendorByRtId(rtId);
+
+        //构造事务Bean
+        List<RtVendorTxBean> beans = wmRtVendorService.getTxBeans(rtId);
+
+        //调用库存核心
+        storageCoreService.processRtVendor(beans);
+
+        //更新单据状态
+        WmRtVendor rtVendor = wmRtVendorService.selectWmRtVendorByRtId(rtId);
+        rtVendor.setStatus(UserConstants.ORDER_STATUS_FINISHED);
+        wmRtVendorService.updateWmRtVendor(rtVendor);
+
+        return Response.success();
+    }
+
+
+}

+ 105 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmRtVendorLineController.java

@@ -0,0 +1,105 @@
+package com.miaxis.mes.controller.wm;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.wm.domain.WmRtVendorLine;
+import com.miaxis.mes.wm.service.IWmRtVendorLineService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 供应商退货行Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-06-13
+ */
+@RestController
+@RequestMapping("/mes/wm/rtvendorline")
+public class WmRtVendorLineController extends BaseController
+{
+    @Autowired
+    private IWmRtVendorLineService wmRtVendorLineService;
+
+    /**
+     * 查询供应商退货行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmRtVendorLine wmRtVendorLine)
+    {
+        startPage();
+        List<WmRtVendorLine> list = wmRtVendorLineService.selectWmRtVendorLineList(wmRtVendorLine);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出供应商退货行列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:export')")
+    @Log(title = "供应商退货行", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmRtVendorLine wmRtVendorLine)
+    {
+        List<WmRtVendorLine> list = wmRtVendorLineService.selectWmRtVendorLineList(wmRtVendorLine);
+        ExcelUtil<WmRtVendorLine> util = new ExcelUtil<WmRtVendorLine>(WmRtVendorLine.class);
+        return util.exportExcel( list, "供应商退货行数据");
+    }
+
+    /**
+     * 获取供应商退货行详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:query')")
+    @GetMapping(value = "/{lineId}")
+    public Response getInfo(@PathVariable("lineId") Long lineId)
+    {
+        return Response.success(wmRtVendorLineService.selectWmRtVendorLineByLineId(lineId));
+    }
+
+    /**
+     * 新增供应商退货行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:add')")
+    @Log(title = "供应商退货行", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmRtVendorLine wmRtVendorLine)
+    {
+        wmRtVendorLine.setCreateBy(getUsername());
+        return toResponse(wmRtVendorLineService.insertWmRtVendorLine(wmRtVendorLine));
+    }
+
+    /**
+     * 修改供应商退货行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:edit')")
+    @Log(title = "供应商退货行", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmRtVendorLine wmRtVendorLine)
+    {
+        return toResponse(wmRtVendorLineService.updateWmRtVendorLine(wmRtVendorLine));
+    }
+
+    /**
+     * 删除供应商退货行
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:remove')")
+    @Log(title = "供应商退货行", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{lineIds}")
+    public Response remove(@PathVariable Long[] lineIds)
+    {
+        return toResponse(wmRtVendorLineService.deleteWmRtVendorLineByLineIds(lineIds));
+    }
+}

+ 134 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmSnController.java

@@ -0,0 +1,134 @@
+package com.miaxis.mes.controller.wm;
+
+import java.util.Date;
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import cn.hutool.core.date.DateUtil;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.system.strategy.AutoCodeUtil;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.wm.domain.WmSn;
+import com.miaxis.mes.wm.service.IWmSnService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * SN码Controller
+ * 
+ * @author yinjinlu
+ * @date 2022-12-08
+ */
+@RestController
+@RequestMapping("/mes/wm/sn")
+public class WmSnController extends BaseController
+{
+    @Autowired
+    private IWmSnService wmSnService;
+
+    @Autowired
+    private AutoCodeUtil autoCodeUtil;
+
+    /**
+     * 查询SN码列表
+     */
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmSn wmSn)
+    {
+        startPage();
+        List<WmSn> list = wmSnService.selectWmSnList(wmSn);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 查询SN码列表
+     */
+    @GetMapping("/listSn")
+    public ResponsePageInfo listSn(WmSn wmSn)
+    {
+        startPage();
+        List<WmSn> list = wmSnService.selectSnList(wmSn);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出SN码列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:sn:export')")
+    @Log(title = "SN码", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmSn wmSn)
+    {
+        List<WmSn> list = wmSnService.selectWmSnList(wmSn);
+        ExcelUtil<WmSn> util = new ExcelUtil<WmSn>(WmSn.class);
+        return util.exportExcel( list, "SN码数据");
+    }
+
+    /**
+     * 获取SN码详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:sn:query')")
+    @GetMapping(value = "/{snId}")
+    public Response getInfo(@PathVariable("snId") Long snId)
+    {
+        return Response.success(wmSnService.selectWmSnBySnId(snId));
+    }
+
+    /**
+     * 新增SN码
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:sn:add')")
+    @Log(title = "SN码", businessType = BusinessTypeEnum.INSERT)
+    @Transactional
+    @PostMapping
+    public Response add(@RequestBody WmSn wmSn)
+    {
+        Date genDate = DateUtil.date();
+        wmSn.setGenDate(genDate);
+        String SNCode= null;
+        if(wmSn.getSnNum()>0){
+            for(int i=0;i<wmSn.getSnNum();i++){
+                SNCode = autoCodeUtil.genSerialCode(UserConstants.SN_CODE,wmSn.getItemCode());
+                wmSn.setSnCode(SNCode);
+                wmSnService.insertWmSn(wmSn);
+            }
+        }
+        return Response.success();
+    }
+
+    /**
+     * 修改SN码
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:sn:edit')")
+    @Log(title = "SN码", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmSn wmSn)
+    {
+        return toResponse(wmSnService.updateWmSn(wmSn));
+    }
+
+    /**
+     * 删除SN码
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:sn:remove')")
+    @Log(title = "SN码", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{snIds}")
+    public Response remove(@PathVariable Long[] snIds)
+    {
+        return toResponse(wmSnService.deleteWmSnBySnIds(snIds));
+    }
+}

+ 164 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmStockTakingController.java

@@ -0,0 +1,164 @@
+package com.miaxis.mes.controller.wm;
+
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.mes.wm.domain.WmStockTaking;
+import com.miaxis.mes.wm.domain.WmStockTakingLine;
+import com.miaxis.mes.wm.domain.WmWarehouse;
+import com.miaxis.mes.wm.service.IWmStockTakingLineService;
+import com.miaxis.mes.wm.service.IWmStockTakingResultService;
+import com.miaxis.mes.wm.service.IWmStockTakingService;
+import com.miaxis.mes.wm.service.IWmWarehouseService;
+import com.miaxis.system.strategy.AutoCodeUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/mes/wm/stocktaking")
+public class WmStockTakingController extends BaseController {
+
+    @Autowired
+    private IWmStockTakingService wmStockTakingService;
+
+    @Autowired
+    private IWmStockTakingLineService wmStockTakingLineService;
+
+    @Autowired
+    private IWmStockTakingResultService wmStockTakingResultService;
+
+    @Autowired
+    private AutoCodeUtil autoCodeUtil;
+
+    @Autowired
+    private IWmWarehouseService wmWarehouseService;
+
+    /**
+     * 查询库存盘点记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmStockTaking wmStockTaking)
+    {
+        startPage();
+        List<WmStockTaking> list = wmStockTakingService.selectWmStockTakingList(wmStockTaking);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 获取库存盘点记录详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:query')")
+    @GetMapping(value = "/{takingId}")
+    public Response getInfo(@PathVariable("takingId") Long takingId)
+    {
+        return Response.success(wmStockTakingService.selectWmStockTakingByTakingId(takingId));
+    }
+
+    /**
+     * 新增库存盘点记录
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:add')")
+    @Log(title = "库存盘点记录", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmStockTaking wmStockTaking)
+    {
+        if(StringUtils.isNotNull(wmStockTaking.getTakingCode())){
+            if(UserConstants.NOT_UNIQUE.equals(wmStockTakingService.checkUnique(wmStockTaking))){
+                throw new CustomException("单据编号已存在!");
+            }
+        }else {
+            wmStockTaking.setTakingCode(autoCodeUtil.genSerialCode(UserConstants.STOCKTAKING_CODE,""));
+        }
+
+        if(StringUtils.isNotNull(wmStockTaking.getWarehouseId())){
+            WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmStockTaking.getWarehouseId());
+            wmStockTaking.setWarehouseCode(warehouse.getWarehouseCode());
+            wmStockTaking.setWarehouseName(warehouse.getWarehouseName());
+        }
+
+        wmStockTakingService.insertWmStockTaking(wmStockTaking);
+        wmStockTaking.setCreateBy(getUsername());
+        return Response.success(wmStockTaking);
+    }
+
+    /**
+     * 修改库存盘点记录
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:edit')")
+    @Log(title = "库存盘点记录", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmStockTaking wmStockTaking)
+    {
+        if(StringUtils.isNotNull(wmStockTaking.getWarehouseId())){
+            WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmStockTaking.getWarehouseId());
+            wmStockTaking.setWarehouseCode(warehouse.getWarehouseCode());
+            wmStockTaking.setWarehouseName(warehouse.getWarehouseName());
+        }
+        return toResponse(wmStockTakingService.updateWmStockTaking(wmStockTaking));
+    }
+
+    /**
+     * 删除库存盘点记录
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:remove')")
+    @Log(title = "库存盘点记录", businessType = BusinessTypeEnum.DELETE)
+    @DeleteMapping("/{takingIds}")
+    public Response remove(@PathVariable Long[] takingIds)
+    {
+        for(Long takingId:takingIds){
+            WmStockTaking taking = wmStockTakingService.selectWmStockTakingByTakingId(takingId);
+            if(!UserConstants.ORDER_STATUS_PREPARE.equals(taking.getStatus())){
+                throw new CustomException("只能删除草稿状态的单据!");
+            }
+            wmStockTakingLineService.deleteByTakingId(takingId);
+            wmStockTakingResultService.deleteWmStockTakingResultByTakingId(takingId);
+        }
+
+        return toResponse(wmStockTakingService.deleteWmStockTakingByTakingIds(takingIds));
+    }
+
+    /**
+     * 完成盘点,系统对比计算盘点结果
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:edit')")
+    @Log(title = "盘点单", businessType = BusinessTypeEnum.UPDATE)
+    @Transactional
+    @PutMapping("/{takingId}")
+    public Response execute(@PathVariable Long takingId){
+        WmStockTaking taking = wmStockTakingService.selectWmStockTakingByTakingId(takingId);
+
+        WmStockTakingLine param = new WmStockTakingLine();
+        param.setTakingId(takingId);
+        List<WmStockTakingLine> lines = wmStockTakingLineService.selectWmStockTakingLineList(param);
+        if(CollectionUtils.isEmpty(lines)){
+            throw new CustomException("未检测到盘点的物资!");
+        }
+
+        //先删除历史记录
+        wmStockTakingResultService.deleteWmStockTakingResultByTakingId(takingId);
+
+        if(UserConstants.WM_STOCK_TAKING_TYPE_OPEN.equals(taking.getTakingType())){
+            //如果是明盘,则直接对比明细中的库存数量和盘点数量
+            wmStockTakingResultService.calculateOpenWmStockTakingResult(takingId);
+        }else {
+            //如果是盲盘,则对比盘点明细中的盘点数量,和当前库存现有量的数量
+            wmStockTakingResultService.calculateWmStockTakingResult(takingId);
+        }
+
+        taking.setStatus(UserConstants.ORDER_STATUS_APPROVED);
+        wmStockTakingService.updateWmStockTaking(taking);
+
+        return Response.success();
+    }
+
+}

+ 59 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmStockTakingLineController.java

@@ -0,0 +1,59 @@
+package com.miaxis.mes.controller.wm;
+
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.mes.wm.domain.WmStockTakingLine;
+import com.miaxis.mes.wm.service.IWmStockTakingLineService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+@RestController
+@RequestMapping("/mes/wm/stocktakingline")
+public class WmStockTakingLineController extends BaseController {
+    @Autowired
+    private IWmStockTakingLineService wmStockTakingLineService;
+
+    /**
+     * 查询库存盘点明细列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmStockTakingLine wmStockTakingLine)
+    {
+        startPage();
+        List<WmStockTakingLine> list = wmStockTakingLineService.selectWmStockTakingLineList(wmStockTakingLine);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出库存盘点明细列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:export')")
+    @Log(title = "库存盘点明细", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmStockTakingLine wmStockTakingLine)
+    {
+        List<WmStockTakingLine> list = wmStockTakingLineService.selectWmStockTakingLineList(wmStockTakingLine);
+        ExcelUtil<WmStockTakingLine> util = new ExcelUtil<WmStockTakingLine>(WmStockTakingLine.class);
+        return util.exportExcel( list, "库存盘点明细数据");
+    }
+
+    /**
+     * 获取库存盘点明细详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:query')")
+    @GetMapping(value = "/{lineId}")
+    public Response getInfo(@PathVariable("lineId") Long lineId)
+    {
+        return Response.success(wmStockTakingLineService.selectWmStockTakingLineByLineId(lineId));
+    }
+
+}

+ 104 - 0
xxgl-admin/src/main/java/com/miaxis/mes/controller/wm/WmStockTakingResultController.java

@@ -0,0 +1,104 @@
+package com.miaxis.mes.controller.wm;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.BusinessTypeEnum; import com.miaxis.common.exception.CustomException;
+import com.miaxis.mes.wm.domain.WmStockTakingResult;
+import com.miaxis.mes.wm.service.IWmStockTakingResultService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 库存盘点结果Controller
+ * 
+ * @author yinjinlu
+ * @date 2023-08-22
+ */
+@RestController
+@RequestMapping("/wm/stocktakingresult")
+public class WmStockTakingResultController extends BaseController
+{
+    @Autowired
+    private IWmStockTakingResultService wmStockTakingResultService;
+
+    /**
+     * 查询库存盘点结果列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:list')")
+    @GetMapping("/list")
+    public ResponsePageInfo list(WmStockTakingResult wmStockTakingResult)
+    {
+        startPage();
+        List<WmStockTakingResult> list = wmStockTakingResultService.selectWmStockTakingResultList(wmStockTakingResult);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出库存盘点结果列表
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:export')")
+    @Log(title = "库存盘点结果", businessType = BusinessTypeEnum.EXPORT)
+    @PostMapping("/export")
+    public Response<String> export(HttpServletResponse response, WmStockTakingResult wmStockTakingResult)
+    {
+        List<WmStockTakingResult> list = wmStockTakingResultService.selectWmStockTakingResultList(wmStockTakingResult);
+        ExcelUtil<WmStockTakingResult> util = new ExcelUtil<WmStockTakingResult>(WmStockTakingResult.class);
+        return util.exportExcel( list, "库存盘点结果数据");
+    }
+
+    /**
+     * 获取库存盘点结果详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:query')")
+    @GetMapping(value = "/{resultId}")
+    public Response getInfo(@PathVariable("resultId") Long resultId)
+    {
+        return Response.success(wmStockTakingResultService.selectWmStockTakingResultByResultId(resultId));
+    }
+
+    /**
+     * 新增库存盘点结果
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:add')")
+    @Log(title = "库存盘点结果", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    public Response add(@RequestBody WmStockTakingResult wmStockTakingResult)
+    {
+        return toResponse(wmStockTakingResultService.insertWmStockTakingResult(wmStockTakingResult));
+    }
+
+    /**
+     * 修改库存盘点结果
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:edit')")
+    @Log(title = "库存盘点结果", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    public Response edit(@RequestBody WmStockTakingResult wmStockTakingResult)
+    {
+        return toResponse(wmStockTakingResultService.updateWmStockTakingResult(wmStockTakingResult));
+    }
+
+    /**
+     * 删除库存盘点结果
+     */
+    @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:remove')")
+    @Log(title = "库存盘点结果", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{resultIds}")
+    public Response remove(@PathVariable Long[] resultIds)
+    {
+        return toResponse(wmStockTakingResultService.deleteWmStockTakingResultByResultIds(resultIds));
+    }
+}

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů