Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/master'

ezhizao_zx 1 anno fa
parent
commit
526849f048

+ 99 - 37
src/main/java/cn/ezhizao/project/business/controller/BizTechnologicalAmendController.java

@@ -1,6 +1,7 @@
 package cn.ezhizao.project.business.controller;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
@@ -14,6 +15,7 @@ import cn.ezhizao.framework.web.page.TableDataInfo;
 import cn.ezhizao.project.business.domain.*;
 import cn.ezhizao.project.business.service.*;
 import cn.ezhizao.project.system.service.ISysDeptService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -34,8 +36,7 @@ import org.springframework.web.bind.annotation.RestController;
  */
 @RestController
 @RequestMapping("/business/amend")
-public class BizTechnologicalAmendController extends BaseController
-{
+public class BizTechnologicalAmendController extends BaseController {
     @Resource
     private IBizTechnologicalAmendService bizTechnologicalAmendService;
 
@@ -43,7 +44,10 @@ public class BizTechnologicalAmendController extends BaseController
     private IBizTechnologicalProcessService bizTechnologicalProcessService;
 
     @Resource
-    private  IBizTechnologicalAmendDetailService bizTechnologicalAmendDetailService;
+    private IBizTechnologicalAmendDetailService bizTechnologicalAmendDetailService;
+
+    @Resource
+    private IBizTechnologicalProcessDetailService bizTechnologicalProcessDetailService;
 
     @Resource
     private IBizLotService bizLotService;
@@ -66,13 +70,18 @@ public class BizTechnologicalAmendController extends BaseController
     @Resource
     private IBizDayworkCarrierService bizDayworkCarrierService;
 
+    @Resource
+    private IBizProductionPlanDetailSubDetailService bizProductionPlanDetailSubDetailService;
+
+    @Resource
+    private IBizDayworkItemService bizDayworkItemService;
+
     /**
      * 查询修改后工艺列表
      */
     @PreAuthorize("@ss.hasPermi('business:amend:list')")
     @GetMapping("/list")
-    public TableDataInfo list(BizTechnologicalAmend bizTechnologicalAmend) throws NoSuchFieldException, IllegalAccessException
-    {
+    public TableDataInfo list(BizTechnologicalAmend bizTechnologicalAmend) throws NoSuchFieldException, IllegalAccessException {
         setTenantId(bizTechnologicalAmend);
         startPage();
         List<BizTechnologicalAmend> list = bizTechnologicalAmendService.getList(bizTechnologicalAmend);
@@ -84,43 +93,40 @@ public class BizTechnologicalAmendController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('business:amend:processList')")
     @GetMapping("/processList")
-    public TableDataInfo processList(BizProcess process) throws NoSuchFieldException, IllegalAccessException
-    {
+    public TableDataInfo processList(BizProcess process) throws NoSuchFieldException, IllegalAccessException {
         return getDataTable(bizProcessService.getList(process));
     }
 
 
-
     @GetMapping("/lotParticulars/{lotCode}")
-    public AjaxResult lotParticulars(@PathVariable("lotCode") String lotCode) throws NoSuchFieldException, IllegalAccessException
-    {
+    public AjaxResult lotParticulars(@PathVariable("lotCode") String lotCode) throws NoSuchFieldException, IllegalAccessException {
         //根据查询批次信息
-        BizLot lot =new BizLot();
+        BizLot lot = new BizLot();
         lot.setLotCode(lotCode);
         try {
-            lot=bizLotService.getList(lot).get(0);
+            lot = bizLotService.getList(lot).get(0);
         } catch (Exception e) {
             throw new RuntimeException("批次信息异常!");
         }
         //查询计划单信息
         lot.setProductionPlanDetail(bizProductionPlanDetailService.getById(lot.getProductionPlanDetailId()));
         //查询报工信息
-        BizDaywork daywork=new BizDaywork();
+        BizDaywork daywork = new BizDaywork();
         daywork.setLotId(lot.getId());
-        daywork=bizDayworkService.getList(daywork).get(0);
+        daywork = bizDayworkService.getList(daywork).get(0);
         lot.setDaywork(daywork);
         //根据报工id和计划单id查询 furnaceNoInfo
-        BizFurnaceNoInfo furnaceNoInfo=new BizFurnaceNoInfo();
+        BizFurnaceNoInfo furnaceNoInfo = new BizFurnaceNoInfo();
         furnaceNoInfo.setProductionPlanDetailId(lot.getProductionPlanDetailId());
         furnaceNoInfo.setDayworkId(daywork.getId());
 
         //查询箱号
-        BizDayworkCarrier dayworkCarrier=new BizDayworkCarrier();
+        BizDayworkCarrier dayworkCarrier = new BizDayworkCarrier();
         dayworkCarrier.setDayworkId(daywork.getId());
         dayworkCarrier.setIsChanged(0);
-        List <BizDayworkCarrier> dayworkCarriers = bizDayworkCarrierService.getList(dayworkCarrier);
-        StringBuffer carrierName=new StringBuffer();
-        dayworkCarriers.forEach(item->{
+        List<BizDayworkCarrier> dayworkCarriers = bizDayworkCarrierService.getList(dayworkCarrier);
+        StringBuffer carrierName = new StringBuffer();
+        dayworkCarriers.forEach(item -> {
             carrierName.append(item.getCarrierCode()).append(", ");
         });
         // 删除末尾多余的逗号和空格
@@ -129,19 +135,80 @@ public class BizTechnologicalAmendController extends BaseController
         }
         lot.setCarrierName(carrierName.toString());
         //设置furnaceNoInfo
-        lot.setFurnaceNoInfo(bizFurnaceNoInfoService.getList(furnaceNoInfo).size()>0?bizFurnaceNoInfoService.getList(furnaceNoInfo).get(0):null);
+        lot.setFurnaceNoInfo(bizFurnaceNoInfoService.getList(furnaceNoInfo).size() > 0 ? bizFurnaceNoInfoService.getList(furnaceNoInfo).get(0) : null);
         lot.getProductionPlanDetail().setRequisitionDepartmentName(sysDeptService.selectDeptById(daywork.getDeptId()).getDeptName());
+        lot = getLot(lot);
+
         return success(lot);
     }
 
+    /**
+     * 查询工序信息
+     */
+    private BizLot getLot(BizLot lot) throws NoSuchFieldException, IllegalAccessException {
+
+        BizTechnologicalProcessDetail processDetail = new BizTechnologicalProcessDetail();
+
+        //是否单批单改
+        if (lot.getIsAmend() == 1) {
+
+        } else if (lot.getIsWasteRecycling() == 1) { //是否废品回用
+
+        } else {
+            processDetail.setTechnologicalProcessId(lot.getTechnologicalProcessId());
+            List<BizTechnologicalProcessDetail> processDetailList = bizTechnologicalProcessDetailService.query().eq("technological_process_id", lot.getTechnologicalProcessId()).list();
+            BizDayworkItem item = new BizDayworkItem();
+            item.setDayworkId(lot.getDaywork().getId());
+            List<BizDayworkItem> dayworkItems = bizDayworkItemService.selectList(item);
+
+            for (BizTechnologicalProcessDetail t : processDetailList) {
+                if (processDetailList.get(0).getProcessId().equals(t.getProcessId())) {
+                    t.setInvestNum(lot.getProductionQuantity());
+                    t.setAbandonNum(0);
+                    t.setQualifiedNum(lot.getProductionQuantity());
+                    t.setStatus("2");
+                }
+                for (BizDayworkItem d : dayworkItems) {
+                    if (t.getProcessId().equals(d.getProcessId())) {
+
+                        if(d.getStatus().equals("2")||d.getStatus().equals("3")){
+                            System.out.println(d.getRejectNum()+",+++++++++++++++++++++++++++++++++++++++++++++++++");
+                            if(d.getRejectNum()!=null){
+                                t.setAbandonNum(t.getAbandonNum()==null?d.getRejectNum():t.getAbandonNum() + d.getRejectNum());
+
+                            }else {
+                                t.setAbandonNum(0);
+                            }
+                            t.setQualifiedNum(t.getQualifiedNum()==null?d.getQualifiedNum():t.getQualifiedNum() + d.getQualifiedNum());
+                            t.setInvestNum(d.getProdNum());
+                        }
+                        if (d.getStatus().equals("0")) {
+                            t.setAbandonNum(0);
+                            t.setQualifiedNum(0);
+                            t.setInvestNum(d.getProdNum());
+                            t.setStatus("0");
+                        } else if (d.getStatus().equals("1") || d.getStatus().equals("2")) {
+                            t.setInvestNum(d.getProdNum());
+                            t.setStatus("1");
+                        } else {
+                            t.setStatus("2");
+                        }
+
+                    }
+                }
+            }
+            lot.setTechnologicalProcessDetailList(processDetailList);
+        }
+        return lot;
+    }
+
     /**
      * 导出修改后工艺列表
      */
     @PreAuthorize("@ss.hasPermi('business:amend:export')")
     @Log(title = "修改后工艺", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, BizTechnologicalAmend bizTechnologicalAmend) throws NoSuchFieldException, IllegalAccessException
-    {
+    public void export(HttpServletResponse response, BizTechnologicalAmend bizTechnologicalAmend) throws NoSuchFieldException, IllegalAccessException {
         setTenantId(bizTechnologicalAmend);
         List<BizTechnologicalAmend> list = bizTechnologicalAmendService.getList(bizTechnologicalAmend);
         ExcelUtil<BizTechnologicalAmend> util = new ExcelUtil<BizTechnologicalAmend>(BizTechnologicalAmend.class);
@@ -154,17 +221,16 @@ public class BizTechnologicalAmendController extends BaseController
     @Log(title = "修改后工艺", businessType = BusinessType.INSERT)
     @PostMapping("/addAmend/{lotId}")
     @Transactional
-    public AjaxResult addAmend(@PathVariable("lotId") Long lotId, @RequestBody List<BizProcess> processList)
-    {
+    public AjaxResult addAmend(@PathVariable("lotId") Long lotId, @RequestBody List<BizProcess> processList) {
         //根据id查询批次信息
         BizLot lot = bizLotService.getById(lotId);
 
-        BizTechnologicalProcess technologicalProcess =new BizTechnologicalProcess();
+        BizTechnologicalProcess technologicalProcess = new BizTechnologicalProcess();
         //是否进行过单批单改
-        if(lot.getIsAmend()==1){
+        if (lot.getIsAmend() == 1) {
             BizTechnologicalAmend technologicalAmend = bizTechnologicalAmendService.getById(lot.getTechnologicalProcessId());
             technologicalProcess = bizTechnologicalProcessService.getById(technologicalAmend.getTechnologicalProcessId());
-        }else{
+        } else {
             technologicalProcess = bizTechnologicalProcessService.getById(lot.getTechnologicalProcessId());
         }
 
@@ -210,7 +276,7 @@ public class BizTechnologicalAmendController extends BaseController
         //修改批次工艺信息
         lot.setTechnologicalProcessId(amend.getId());
         lot.setIsAmend(1);
-        return success(bizTechnologicalAmendDetailService.saveBatch(amendDetailList)&&bizLotService.updateById(lot));
+        return success(bizTechnologicalAmendDetailService.saveBatch(amendDetailList) && bizLotService.updateById(lot));
     }
 
     /**
@@ -218,8 +284,7 @@ public class BizTechnologicalAmendController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('business:amend:query')")
     @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
         return success(bizTechnologicalAmendService.getById(id));
     }
 
@@ -229,8 +294,7 @@ public class BizTechnologicalAmendController extends BaseController
     @PreAuthorize("@ss.hasPermi('business:amend:add')")
     @Log(title = "修改后工艺", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody BizTechnologicalAmend bizTechnologicalAmend) throws NoSuchFieldException, IllegalAccessException
-    {
+    public AjaxResult add(@RequestBody BizTechnologicalAmend bizTechnologicalAmend) throws NoSuchFieldException, IllegalAccessException {
         setTenantId(bizTechnologicalAmend);
         return toAjax(bizTechnologicalAmendService.save(bizTechnologicalAmend));
     }
@@ -241,8 +305,7 @@ public class BizTechnologicalAmendController extends BaseController
     @PreAuthorize("@ss.hasPermi('business:amend:edit')")
     @Log(title = "修改后工艺", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody BizTechnologicalAmend bizTechnologicalAmend) throws NoSuchFieldException, IllegalAccessException
-    {
+    public AjaxResult edit(@RequestBody BizTechnologicalAmend bizTechnologicalAmend) throws NoSuchFieldException, IllegalAccessException {
         setTenantId(bizTechnologicalAmend);
         return toAjax(bizTechnologicalAmendService.updateById(bizTechnologicalAmend));
     }
@@ -252,9 +315,8 @@ public class BizTechnologicalAmendController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('business:amend:remove')")
     @Log(title = "修改后工艺", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable List<Long> ids)
-    {
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable List<Long> ids) {
         return toAjax(bizTechnologicalAmendService.removeBatchByIds(ids));
     }
 }

+ 16 - 0
src/main/java/cn/ezhizao/project/business/domain/BizTechnologicalProcessDetail.java

@@ -83,6 +83,22 @@ public class BizTechnologicalProcessDetail extends BaseEntity
 
     private String processKey;
 
+    //完成状态
+    @TableField(exist = false)
+    private String status;
+
+    //投入量
+    @TableField(exist = false)
+    private Integer investNum;
+
+    //合格量
+    @TableField(exist = false)
+    private Integer qualifiedNum;
+
+    //废品量
+    @TableField(exist = false)
+    private Integer abandonNum;
+
     @TableField(exist = false)
     private String remark;
 

+ 5 - 0
src/main/java/cn/ezhizao/project/business/mapper/BizDayworkItemMapper.java

@@ -41,4 +41,9 @@ public interface BizDayworkItemMapper extends BaseMapper<BizDayworkItem>
     public void updateDayworkItem(BizDayworkItem bizDayworkItem);
 
     List<BizDayworkItem> getItemScreen(Long dayWorkId);
+
+    List<BizDayworkItem> selectList(BizDayworkItem bizDayworkItem);
+
+
+
 }

+ 2 - 0
src/main/java/cn/ezhizao/project/business/service/IBizDayworkItemService.java

@@ -42,4 +42,6 @@ public interface IBizDayworkItemService extends IService<BizDayworkItem>
     public void updateDayworkItem(BizDayworkItem bizDayworkItem);
 
     List<BizDayworkItem> getItemScreen(Long dayWorkId);
+
+    List<BizDayworkItem> selectList(BizDayworkItem item);
 }

+ 4 - 0
src/main/java/cn/ezhizao/project/business/service/impl/BizDayworkItemServiceImpl.java

@@ -63,6 +63,10 @@ public class BizDayworkItemServiceImpl extends ServiceImpl<BizDayworkItemMapper,
         return bizDayworkItemMapper.getItemScreen(dayWorkId);
     }
 
+    @Override
+    public List<BizDayworkItem> selectList(BizDayworkItem item) {
+        return bizDayworkItemMapper.selectList(item);
+    }
 
 
 }

+ 20 - 0
src/main/resources/mybatis/business/BizDayworkItemMapper.xml

@@ -8,6 +8,7 @@
         <id column="id" property="id"/>
         <result column="lot_id" property="lotId"/>
         <association property="lotCode" javaType="java.lang.String" column="lot_id" select="getLotCode"/>
+        <association property="rejectNum" javaType="java.lang.Integer" column="id" select="getRejectNum"/>
     </resultMap>
 
     <select id="getLotCode" parameterType="Long" resultType="java.lang.String">
@@ -38,6 +39,25 @@
         WHERE bdi.daywork_id = #{dayWorkId}
     </select>
 
+    <select id="getRejectNum"  resultType="java.lang.Integer">
+        SELECT SUM(reject_num)
+        FROM biz_daywork_item_reject
+        WHERE daywork_item_id = #{id}
+        AND deleted = 0
+    </select>
+
+    <select id="selectList" parameterType="BizDayworkItem" resultMap="BizDayworkItemResult">
+        SELECT * FROM biz_daywork_item
+        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
+            deleted = 0
+            <if test="dayworkId != null and dayworkId != ''">AND daywork_id = #{dayworkId}</if>
+
+        </trim>
+        ORDER BY create_time ASC
+    </select>
+
+
+
     <select id="getEquipmentInfo" resultType="cn.ezhizao.project.business.domain.BizProductionResourceGroupDetail">
         select equipment_detail_id as value,equipment_detail_code as label from biz_daywork_item where deleted = 0 and id = #{dayworkItemId}
     </select>