From eb6f654fe2693d94e62c350638179b3cc95a4fb0 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期四, 23 五月 2024 10:39:23 +0800
Subject: [PATCH] 修改发货删除
---
north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java | 159 +++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 123 insertions(+), 36 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 aba88e0..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
@@ -4,30 +4,45 @@
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.Order;
-import com.example.erp.entity.sd.OrderDetail;
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
+ final
FlowCardMapper flowCardMapper;
+ final
+ OrderGlassDetailMapper orderGlassDetailMapper;
+ final
+ OrderProcessDetailMapper orderProcessDetailMapper;
+
+ public FlowCardService(FlowCardMapper flowCardMapper, OrderGlassDetailMapper orderGlassDetailMapper, OrderProcessDetailMapper orderProcessDetailMapper) {
+ this.flowCardMapper = flowCardMapper;
+ this.orderGlassDetailMapper = orderGlassDetailMapper;
+ this.orderProcessDetailMapper = orderProcessDetailMapper;
+ }
//娴佺▼鍗$鐞嗘煡璇�
- public Map<String, Object> selectProcessCard(Date selectTime1, Date selectTime2, FlowCard flowCard) {
+ 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("data", flowCardMapper.selectFlowCard(offset, pageSize, selectTime1, selectTime2, flowCard));
+ map.put("total", flowCardMapper.getPageTotal(offset, pageSize, selectTime1, selectTime2, flowCard));
return map;
}
@@ -39,23 +54,34 @@
}
//鍒嗘灦鏄庣粏鏌ヨ
- public Map<String, Object> DetailsSelectSv(String orderId, FlowCard flowCard) {
+ public Map<String, Object> detailsSelectSv(String orderId, FlowCard flowCard) {
Map<String, Object> map = new HashMap<>();
- map.put("data", flowCardMapper.DetailsSelectMp(orderId, flowCard));
+ map.put("data", flowCardMapper.detailsSelectMp(orderId, flowCard));
return map;
}
//鍒犻櫎娴佺▼鍗�
- public Boolean DeleteFlowCardSv(String orderId, String processId) {
+ public Boolean deleteFlowCardSv(String orderId, String processId) {
if (!orderId.isEmpty() && !processId.isEmpty()) {
- Integer count = flowCardMapper.ReportingWorkCount(processId);
+ //鍒ゆ柇璇ユ祦绋嬪崱鏄惁鎶ュ伐
+ Integer count = flowCardMapper.reportingWorkCount(processId);
if (count == 0) {
- //淇敼璁㈠崟琛ㄥ垎鏋剁姸鎬佷负1,鏈叏閮ㄥ垎鏋跺畬鎴�
- flowCardMapper.UpdateProcessingCard(orderId, 1);
+
//淇敼鍒嗘灦鐘舵��
- flowCardMapper.UpdateDeleteState(orderId, processId);
+ flowCardMapper.updateDeleteState(orderId, processId);
+ //鍒犻櫎鎶ュ伐娴佺▼鏄庣粏琛ㄦ暟鎹�
+ flowCardMapper.deleteReportingWork(processId);
//鍒犻櫎鍒嗘灦鏄庣粏
- flowCardMapper.DeleteFlowCardMp(orderId, 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;
@@ -67,23 +93,21 @@
}
//鍒嗘灦鏂板鏄庣粏鏌ヨ
- public Map<String, Object> SelectNoCardSv(String orderId, String productionId, FlowCard flowCard) {
+ 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));
+ map.put("data", flowCardMapper.selectNoCardMp(orderId, productionId, flowCard));
return map;
}
//淇敼鎺掔増鐘舵��
- public Boolean UpdateLayoutStatusSv(String processId) {
+ public Boolean updateLayoutStatusSv(String processId, Integer state) {
if (!processId.isEmpty()) {
- Integer Status = flowCardMapper.SelectLayoutStatus(processId);
- if (Status == 1) {
- flowCardMapper.UpdateLayoutStatusMp(processId);
- } else {
- return false;
- }
+// Integer Status = flowCardMapper.selectLayoutStatus(processId);
+
+ flowCardMapper.updateLayoutStatusMp(processId, state);
+
return true;
} else {
@@ -92,7 +116,7 @@
}
//淇濆瓨娴佺▼鍗℃暟鎹�
- public Boolean AddFlowCardSv(Map<String, Object> object) {
+ public Boolean addFlowCardSv(Map<String, Object> object) {
String userName = "";
if (object.get("userName") != null) {
userName = object.get("userName").toString();
@@ -107,34 +131,49 @@
if (!FlowCardList.isEmpty()) {
for (FlowCard flowCard : FlowCardList) {
//鏌ヨ姣忎釜搴忓彿鐨勫眰鏁�
- Integer layer = flowCardMapper.SelectLayer(productionId, flowCard.getOrderNumber());
+ Integer layer = flowCardMapper.selectLayer(productionId, flowCard.getOrderNumber());
//娣诲姞娴佺▼鍗℃暟鎹�
- flowCardMapper.AddFlowCardMp(flowCard.getProcessId(), flowCard.getOrderNumber(), flowCard.getLandingSequence(), flowCard.getQuantity(), productionId, userName,layer);
+ flowCardMapper.addFlowCardMp(flowCard.getProcessId(), flowCard.getOrderNumber(), flowCard.getLandingSequence(), flowCard.getQuantity(), productionId, userName, layer);
//淇敼鍒嗘灦鐘舵�侊紝灏嗙姸鎬佹敼涓�1
- flowCardMapper.UpdateFlowState(productionId, flowCard.getOrderNumber());
+ flowCardMapper.updateFlowState(productionId, flowCard.getOrderNumber());
//鏌ヨ璇ヨ鍗曟湭鍒嗘灦鏁伴噺
- Integer FlowCount = flowCardMapper.SelectFlowCount(productionId);
+ Integer FlowCount = flowCardMapper.selectFlowCount(productionId);
if (FlowCount == 0) {
//淇敼璁㈠崟琛ㄥ垎鏋剁姸鎬佷负2
- flowCardMapper.UpdateProcessingCard(productionId, 2);
+ flowCardMapper.updateProcessingCard(productionId, 2);
} else {
//淇敼璁㈠崟琛ㄥ垎鏋剁姸鎬佷负1,鏈叏閮ㄥ垎鏋跺畬鎴�
- flowCardMapper.UpdateProcessingCard(productionId, 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) {
+ 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));
+ 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));
+ } else if (state == 1) {//鏈帓浜�
+ map.put("data", flowCardMapper.selectNoSchedulingMp(selectTime1, selectTime2, orderId, processes, flowCard));
}
@@ -148,4 +187,52 @@
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