From c581a6c396f1b367fe132bc302d6337b1ff0ad6f Mon Sep 17 00:00:00 2001
From: guoyuji <guoyujie@ng.com>
Date: 星期一, 22 四月 2024 08:36:36 +0800
Subject: [PATCH] Merge branch 'master' of https://gitee.com/a1536384743/erp_-override
---
north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java | 222 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 215 insertions(+), 7 deletions(-)
diff --git a/north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java b/north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java
index 8fb17ab..981e4d7 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java
+++ b/north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java
@@ -1,30 +1,238 @@
package com.example.erp.service.pp;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.erp.entity.pp.FlowCard;
+import com.example.erp.entity.sd.OrderGlassDetail;
+import com.example.erp.entity.sd.OrderProcessDetail;
import com.example.erp.mapper.pp.FlowCardMapper;
-import org.springframework.beans.factory.annotation.Autowired;
+import com.example.erp.mapper.sd.OrderGlassDetailMapper;
+import com.example.erp.mapper.sd.OrderProcessDetailMapper;
import org.springframework.stereotype.Service;
import java.sql.Date;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
+
+import static com.example.erp.service.sd.OrderService.getOrderProcessDetails;
@Service
@DS("pp")
public class FlowCardService {
- @Autowired
- FlowCardMapper flowCardMapper;
+ final
+ FlowCardMapper flowCardMapper;
+ final
+ OrderGlassDetailMapper orderGlassDetailMapper;
+ final
+ OrderProcessDetailMapper orderProcessDetailMapper;
- public Map<String, Object> selectProcessCard(Date selectTime1, Date selectTime2, FlowCard flowCard) {
+ public FlowCardService(FlowCardMapper flowCardMapper, OrderGlassDetailMapper orderGlassDetailMapper, OrderProcessDetailMapper orderProcessDetailMapper) {
+ this.flowCardMapper = flowCardMapper;
+ this.orderGlassDetailMapper = orderGlassDetailMapper;
+ this.orderProcessDetailMapper = orderProcessDetailMapper;
+ }
+
+ //娴佺▼鍗$鐞嗘煡璇�
+ public Map<String, Object> selectProcessCard(Integer pageNum, Integer pageSize, Date selectTime1, Date selectTime2, FlowCard flowCard) {
+ Integer offset = (pageNum - 1) * pageSize;
Map<String, Object> map = new HashMap<>();
- // System.out.println(flowCardMapper.selectFlowCard( selectTime1,selectTime2, flowCard));
- map.put("data", flowCardMapper.selectFlowCard( selectTime1,selectTime2, flowCard));
- // map.put("total", productMapper.getPageTotal(offset, pageSize, glassTypeId, product));
+ map.put("data", flowCardMapper.selectFlowCard(offset, pageSize, selectTime1, selectTime2, flowCard));
+ map.put("total", flowCardMapper.getPageTotal(offset, pageSize, selectTime1, selectTime2, flowCard));
+ return map;
+ }
+
+ //鍒嗘灦鏌ヨ
+ public Map<String, Object> selectAddProcess(Date selectTime1, Date selectTime2, FlowCard flowCard) {
+ Map<String, Object> map = new HashMap<>();
+ map.put("data", flowCardMapper.selectFlowCardMp(selectTime1, selectTime2, flowCard));
+ return map;
+ }
+
+ //鍒嗘灦鏄庣粏鏌ヨ
+ public Map<String, Object> detailsSelectSv(String orderId, FlowCard flowCard) {
+ Map<String, Object> map = new HashMap<>();
+ map.put("data", flowCardMapper.detailsSelectMp(orderId, flowCard));
+ return map;
+ }
+
+ //鍒犻櫎娴佺▼鍗�
+ public Boolean deleteFlowCardSv(String orderId, String processId) {
+ if (!orderId.isEmpty() && !processId.isEmpty()) {
+ //鍒ゆ柇璇ユ祦绋嬪崱鏄惁鎶ュ伐
+ Integer count = flowCardMapper.reportingWorkCount(processId);
+ if (count == 0) {
+
+ //淇敼鍒嗘灦鐘舵��
+ flowCardMapper.updateDeleteState(orderId, processId);
+ //鍒犻櫎鎶ュ伐娴佺▼鏄庣粏琛ㄦ暟鎹�
+ flowCardMapper.deleteReportingWork(processId);
+ //鍒犻櫎鍒嗘灦鏄庣粏
+ flowCardMapper.deleteFlowCardMp(orderId, processId);
+ //鍒ゆ柇璇ヨ鍗曟祦绋嬪崱鏄惁鍏ㄩ儴鍒犻櫎
+ Integer flowNumber = flowCardMapper.selectFlowCardCount(orderId);
+ if (flowNumber == 0) {
+ //淇敼璁㈠崟琛ㄥ垎鏋剁姸鎬佷负0,鍏ㄩ儴鍒犻櫎
+ flowCardMapper.updateProcessingCard(orderId, 0);
+ } else {
+ //淇敼璁㈠崟琛ㄥ垎鏋剁姸鎬佷负1,鍒犻櫎閮ㄥ垎
+ flowCardMapper.updateProcessingCard(orderId, 1);
+ }
+ return true;
+ } else {
+ return false;
+ }
+
+ } else {
+ return false;
+ }
+ }
+
+ //鍒嗘灦鏂板鏄庣粏鏌ヨ
+ public Map<String, Object> selectNoCardSv(String orderId, String productionId, FlowCard flowCard) {
+ Map<String, Object> map = new HashMap<>();
+ map.put("data", flowCardMapper.selectNoCardMp(orderId, productionId, flowCard));
return map;
}
+ //淇敼鎺掔増鐘舵��
+ public Boolean updateLayoutStatusSv(String processId, Integer state) {
+ if (!processId.isEmpty()) {
+// Integer Status = flowCardMapper.selectLayoutStatus(processId);
+
+ flowCardMapper.updateLayoutStatusMp(processId, state);
+
+
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ //淇濆瓨娴佺▼鍗℃暟鎹�
+ public Boolean addFlowCardSv(Map<String, Object> object) {
+ String userName = "";
+ if (object.get("userName") != null) {
+ userName = object.get("userName").toString();
+ }
+
+ String productionId = "";
+ if (object.get("productionId") != null) {
+ productionId = object.get("productionId").toString();
+ }
+
+ List<FlowCard> FlowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("flowCard")), FlowCard.class);
+ if (!FlowCardList.isEmpty()) {
+ for (FlowCard flowCard : FlowCardList) {
+ //鏌ヨ姣忎釜搴忓彿鐨勫眰鏁�
+ Integer layer = flowCardMapper.selectLayer(productionId, flowCard.getOrderNumber());
+ //娣诲姞娴佺▼鍗℃暟鎹�
+ flowCardMapper.addFlowCardMp(flowCard.getProcessId(), flowCard.getOrderNumber(), flowCard.getLandingSequence(), flowCard.getQuantity(), productionId, userName, layer);
+ //淇敼鍒嗘灦鐘舵�侊紝灏嗙姸鎬佹敼涓�1
+ flowCardMapper.updateFlowState(productionId, flowCard.getOrderNumber());
+ //鏌ヨ璇ヨ鍗曟湭鍒嗘灦鏁伴噺
+ Integer FlowCount = flowCardMapper.selectFlowCount(productionId);
+ if (FlowCount == 0) {
+ //淇敼璁㈠崟琛ㄥ垎鏋剁姸鎬佷负2
+ flowCardMapper.updateProcessingCard(productionId, 2);
+ } else {
+ //淇敼璁㈠崟琛ㄥ垎鏋剁姸鎬佷负1,鏈叏閮ㄥ垎鏋跺畬鎴�
+ flowCardMapper.updateProcessingCard(productionId, 1);
+ }
+ //鏌ヨ璁㈠崟灏忕墖琛ㄨ幏鍙栧伐鑹轰紶鍏ュ皬鐗囧伐鑹鸿〃
+ List<OrderGlassDetail> orderGlassDetailList =
+ orderGlassDetailMapper.selectList(
+ new QueryWrapper<OrderGlassDetail>()
+ .eq("order_id", flowCard.getProcessId().substring(0, 10))
+ .eq("order_number", flowCard.getOrderNumber())
+ );
+ List<OrderProcessDetail> orderProcessDetailList = getOrderProcessDetails(orderGlassDetailList);
+ orderProcessDetailList.forEach(
+ orderGlassDetail -> orderGlassDetail.setProcessId(flowCard.getProcessId()));
+
+
+ //璧嬪�艰鍗曞伐鑹鸿〃
+ orderProcessDetailMapper.insertOrderProcessDetail(orderProcessDetailList);
+ }
+
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public Map<String, Object> selectSchedulingSv(String selectTime1, String selectTime2, String orderId, String processes, Integer state, FlowCard flowCard) {
+ Map<String, Object> map = new HashMap<>();
+ if (state == 2) {//宸叉帓浜�
+ map.put("data", flowCardMapper.selectOkSchedulingMp(selectTime1, selectTime2, orderId, processes, flowCard));
+
+ } else if (state == 1) {//鏈帓浜�
+ map.put("data", flowCardMapper.selectNoSchedulingMp(selectTime1, selectTime2, orderId, processes, flowCard));
+
+ }
+
+ return map;
+ }
+
+
+ //棣栨鏌ヨ鎺掔増鏁版嵁
+ public Map<String, Object> selectLastScheduling(String selectTime1, String selectTime2, FlowCard flowCard) {
+ Map<String, Object> map = new HashMap<>();
+ map.put("data", flowCardMapper.selectLastSchedulingMp(selectTime1, selectTime2, flowCard));
+ return map;
+ }
+
+ public Object flowCardDetailSv(String processId, FlowCard flowCard) {
+ Map<String, Object> map = new HashMap<>();
+ map.put("data", flowCardMapper.flowCardDetailMp(processId, flowCard));
+ return map;
+ }
+
+ public Object selectPrintFlowCardSv(Date selectTime1, Date selectTime2, String orderId, String project, FlowCard flowCard) {
+ if ("null".equals(orderId)) {
+ orderId = "";
+ }
+ if ("null".equals(project)) {
+ project = "";
+ }
+ Map<String, Object> map = new HashMap<>();
+ map.put("data", flowCardMapper.selectPrintFlowCardMp(selectTime1, selectTime2, orderId, project, flowCard));
+ return map;
+ }
+
+ public Object selectPrintSv(String orderId, FlowCard flowCard) {
+ Map<String, Object> map = new HashMap<>();
+ map.put("data", flowCardMapper.selectPrintMp(orderId, flowCard));
+ return map;
+ }
+
+ public Map<String, Object> getSelectPrintingSv(Map<String, Object> object) {
+ Map<String, Object> map = new HashMap<>();
+ List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();//鏈�缁堢粨鏋�
+ List<FlowCard> flowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("printList")), FlowCard.class);
+ if (!flowCardList.isEmpty()) {
+ for (FlowCard flowCard : flowCardList) {
+ Map<String, Object> itemmap = new HashMap<>();
+ //娴佺▼鍗¤〃澶磋〃灏炬暟鎹�
+ itemmap.put("detail", flowCardMapper.getPrimaryList(flowCard.getProcessId(), flowCard.getTechnologyNumber()));
+ //娴佺▼鍗℃槑缁嗘暟鎹�
+ List<Map<String, Object>> detailList = flowCardMapper.getDetailList(flowCard.getProcessId(), flowCard.getTechnologyNumber());
+ //宸ヨ壓娴佺▼
+ List<Map<String, Object>> processList = flowCardMapper.getProcessList(flowCard.getProcessId(), flowCard.getTechnologyNumber());
+ itemmap.put("detailList", detailList);
+ itemmap.put("processList", processList);
+ list.add(itemmap);
+
+
+ }
+ }
+ map.put("data", list);
+ return map;
+ }
}
--
Gitblit v1.8.0