north-glass-erp/northglass-erp/src/views/pp/processCard/SelectDetailProcessCard.vue
@@ -2,7 +2,7 @@ import request from "@/utils/request" import deepClone from "@/utils/deepClone" import {ElDatePicker, ElMessage} from "element-plus" import {ElDatePicker, ElMessage, ElMessageBox} from "element-plus" import useProductGlassTypeStore from "@/stores/sd/product/productGlassType" import footSum from "@/hook/footSum" import {nextTick, onMounted, onUnmounted, reactive, ref, watch} from "vue" @@ -208,18 +208,32 @@ flowCard: selectRecords }) request.post("/processCard/mergeFlowCard", flowData.value).then((res) => { if(res.code==200 && res.data==="true"){ ElMessage.success(t('basicData.msg.saveSuccess')) router.push({path: '/main/processCard/SelectProcessCard', query:{random:Math.random()}}) }else{ ElMessage.warning(t('basicData.msg.saveFail')) } }).catch((err)=>{ ElMessage.error(t('basicData.msg.ServerConnectionError')) router.push("/login") ElMessageBox.confirm( "是否合并?", { confirmButtonText: t('basicData.confirmButtonText'), cancelButtonText: t('basicData.cancelButtonText'), distinguishCancelAndClose: true, type: 'warning', } ).then(()=>{ request.post("/processCard/mergeFlowCard", flowData.value).then((res) => { if(res.code==200 && res.data==="true"){ ElMessage.success(t('basicData.msg.saveSuccess')) router.push({path: '/main/processCard/SelectProcessCard', query:{random:Math.random()}}) }else{ ElMessage.warning(t('basicData.msg.saveFail')) } }).catch((err)=>{ ElMessage.error(t('basicData.msg.ServerConnectionError')) router.push("/login") }) }) break } } } north-glass-erp/src/main/java/com/example/erp/mapper/pp/FlowCardMapper.java
@@ -179,7 +179,7 @@ List<Map<String, Object>> selectFlowCardMerge(String processId); Boolean updateFlowCardMerge(String processId); Boolean updateFlowCardMerge(String processId,List<Integer> technologyNumbers); Boolean deleteflowCardSort(String orderId, String processId); north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java
@@ -27,6 +27,7 @@ import java.sql.Date; import java.util.*; import java.util.stream.Collectors; import static com.example.erp.service.sd.OrderService.getOrderProcessDetails; @@ -718,11 +719,17 @@ List<FlowCard> flowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("flowCard")), FlowCard.class); if (!flowCardList.isEmpty()) { List<Map<String, Object>> flowCardList1=flowCardMapper.selectFlowCardMerge(flowCardList.get(0).getProcessId()); if(flowCardList1.size()==1){ flowCardMapper.updateFlowCardMerge(flowCardList.get(0).getProcessId()); returns="true"; for(int i = 0;i < flowCardList1.size();i++){ if(Integer.valueOf(flowCardList1.get(i).get("count2").toString())>1){ List<Integer> technologyNumber = Arrays.stream(flowCardList1.get(i).get("count1").toString().split(",")) .map(Integer::parseInt) .collect(Collectors.toList()); flowCardMapper.updateFlowCardMerge(flowCardList.get(0).getProcessId(),technologyNumber); returns="true"; } } } return returns; north-glass-erp/src/main/java/com/example/erp/service/sd/OrderService.java
@@ -402,26 +402,72 @@ Order order = JSONObject.parseObject(JSONObject.toJSONString(jsonObject.get("order")), Order.class); List<OrderDetail> OrderDetails = JSONArray.parseArray(JSONObject.toJSONString(jsonObject.get("detail")), OrderDetail.class); List<OrderOtherMoney> orderOtherMoneyList = JSONArray.parseArray(JSONObject.toJSONString(jsonObject.get("otherMoney")), OrderOtherMoney.class); double money = 0; for (OrderDetail orderDetail : OrderDetails) { orderDetail = updateOrderMoneyComputed(orderDetail,order.getCalculateType()); BigDecimal getGrossAmount= BigDecimal.valueOf(orderDetail.getGrossAmount()); money+=getGrossAmount.doubleValue(); if(orderOtherMoneyList != null ){ orderOtherMoneyList = orderOtherMoneyList.stream().filter(o -> o.getColumn().indexOf("M")==0).collect(Collectors.toList()); } if(orderOtherMoneyList!=null){ orderOtherMoneyList.forEach(orderOtherMoney -> { orderOtherMoney.setQuantity(0.0); }); } Log log = new Log(); log.setOperator(order.getCreator()); log.setOperatorId(order.getCreatorId()); log.setContent(jsonObject.toString()); log.setFunction("updateOrderMoney金额重置:"+order.getOrderId()); orderOtherMoneyList.forEach(orderOtherMoney -> { if(orderOtherMoney.getQuantity()!=null && orderOtherMoney.getPrice()!=null){ orderOtherMoney.setMoney((orderOtherMoney.getQuantity()*orderOtherMoney.getPrice())); //删除其他金额明细表 orderOtherMoneyMapper.delete(new LambdaQueryWrapper<OrderOtherMoney>().eq(OrderOtherMoney::getOrderId, order.getOrderId())); List<OrderOtherMoney> orderOtherMoneyLists=orderOtherMoneyList; double money = 0; for (OrderDetail orderDetail : OrderDetails) { orderDetail = updateOrderMoneyComputed(orderDetail,order.getCalculateType()); BigDecimal getGrossAmount= BigDecimal.valueOf(orderDetail.getGrossAmount()); money+=getGrossAmount.doubleValue(); Map<String,Object> otherColumns = JSON.parseObject(orderDetail.getOtherColumns(), new TypeReference<Map<String, Object>>(){}); if(otherColumns!=null){ otherColumns.values().removeIf(value -> value == null || value.equals("")); orderDetail.setOtherColumns(JSON.toJSONString(otherColumns)); OrderDetail finalOrderDetail = orderDetail; otherColumns.forEach((key, value) ->{ if(value!=null && !value.equals("") && key.contains("M")) { orderOtherMoneyLists.forEach(orderOtherMoney -> { if (orderOtherMoney.getColumn().equals(key)) { orderOtherMoney.setQuantity( orderOtherMoney.getQuantity()+(Double.parseDouble((String) value) * finalOrderDetail.getQuantity())); } }); } }); }else{ orderDetail.setOtherColumns("{}"); } orderOtherMoneyMapper.update(orderOtherMoney,new QueryWrapper<OrderOtherMoney>() .eq("order_id",orderOtherMoney.getOrderId()) .eq("`column`",orderOtherMoney.getColumn())); }); orderDetailMapper.update(orderDetail,new QueryWrapper<OrderDetail>() .eq("order_id",orderDetail.getOrderId()) .eq("`order_number`",orderDetail.getOrderNumber())); } if(orderOtherMoneyLists!=null){ orderOtherMoneyLists.forEach(orderOtherMoney ->{ orderOtherMoney.setId(null); orderOtherMoney.setOrderId(order.getOrderId()); if(orderOtherMoney.getQuantity()!=null && orderOtherMoney.getPrice()!=null){ orderOtherMoney.setMoney((orderOtherMoney.getQuantity()*orderOtherMoney.getPrice())); }else { orderOtherMoney.setMoney(0.0); } orderOtherMoneyMapper.insert(orderOtherMoney); }); } order.setMoney(money+orderOtherMoneyMapper.selectGrossAmount(order.getOrderId())); order.setOtherMoney(orderOtherMoneyMapper.selectGrossAmount(order.getOrderId())); orderMapper.updateMoney(order); north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
@@ -2250,7 +2250,7 @@ </select> <select id="selectFlowCardMerge"> select * select *,GROUP_CONCAT(DISTINCT fc.technology_number) as count1,count(DISTINCT fc.technology_number) as count2 from pp.flow_card as fc left join sd.order_glass_detail as ogd on fc.order_id = ogd.order_id and fc.order_number = ogd.order_number and @@ -2262,7 +2262,10 @@ <update id="updateFlowCardMerge"> update pp.flow_card fc set fc.merge=1 where fc.process_id = #{processId} where fc.process_id = #{processId} and fc.technology_number in <foreach item="technologyNumber" collection="technologyNumbers" open="(" separator="," close=")"> #{technologyNumber} </foreach> </update> <delete id="deleteflowCardSort">