| | |
| | | orderDetails.forEach(item => { |
| | | item.otherColumns = JSON.parse(item.otherColumns) |
| | | }) |
| | | otherMoney.value =res.data.orderOtherMoneyList |
| | | otherMoney.value =res.data.orderOtherMoneyList.filter(item => item.column.indexOf('M')>-1) |
| | | //加载副表数据 |
| | | xGrid.value.reloadData(orderDetails) |
| | | gridOptions.loading = false |
| | |
| | | if(res.code==200){ |
| | | titleSelectJson.value=deepClone(res.data) |
| | | //其他金额 |
| | | otherMoney.value = titleSelectJson.value.orderOtherMoney[0] |
| | | otherMoney.value = titleSelectJson.value.orderOtherMoney[0].filter(item => item.column.indexOf('M')>-1) |
| | | //let columns = [] |
| | | otherMoney.value.forEach(item => { |
| | | titleSelectJson.value.orderOtherMoney[0].forEach(item => { |
| | | let column = { |
| | | field: `otherColumns.${item.column}`, |
| | | width:50, title: item.alias, |
| | | width:100, |
| | | title: item.alias, |
| | | editRender: { |
| | | name: 'input', |
| | | } |
| | | } |
| | | gridOptions.editRules[`otherColumns.${item.column}`] = [ |
| | | { |
| | | validator ({ cellValue }) { |
| | | const regex = /^(0|[1-9][0-9]{0,4}([.][0-9]{1,2})?)$/ |
| | | if (cellValue && !regex.test(cellValue)) { |
| | | return new Error(t('basicData.msg.range99999Dec2')) |
| | | //判断 其他列是否是数字 |
| | | if(item.column.indexOf('M')>-1){ |
| | | gridOptions.editRules[`otherColumns.${item.column}`] = [ |
| | | { |
| | | validator ({ cellValue }) { |
| | | const regex = /^(0|[1-9][0-9]{0,4}([.][0-9]{1,2})?)$/ |
| | | if (cellValue && !regex.test(cellValue)) { |
| | | return new Error(t('basicData.msg.range99999Dec2')) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | ] |
| | | }else{ |
| | | gridOptions.editRules[`otherColumns.${item.column}`] = [ |
| | | { required: false}, |
| | | { min: 0, max: 255, message: t('basicData.msg.max255') } |
| | | ] |
| | | } |
| | | |
| | | //columns.push(column) |
| | | gridOptions.columns.push(column) |
| | |
| | | package com.example.erp.service.sd; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.example.erp.entity.sd.BasicData; |
| | | import com.example.erp.entity.sd.BasicOtherMoney; |
| | | import com.example.erp.entity.sd.Customer; |
| | | import com.example.erp.mapper.sd.BasicDateMapper; |
| | | import com.example.erp.mapper.sd.BasicOtherMoneyMapper; |
| | |
| | | orderBasicDataMap.get("customer").add(customer); |
| | | } |
| | | |
| | | orderBasicDataMap.put("orderOtherMoney", Collections.singletonList(basicOtherMoneyMapper.selectList(null))); |
| | | orderBasicDataMap.put("orderOtherMoney", |
| | | Collections.singletonList( |
| | | basicOtherMoneyMapper.selectList(new QueryWrapper<BasicOtherMoney>().eq("state",1)) |
| | | )); |
| | | |
| | | |
| | | //返回Map对象 |
| | |
| | | Order order = JSONObject.parseObject(JSONObject.toJSONString(orderJson.get("title")), Order.class); |
| | | List<OrderDetail> OrderDetails = JSONArray.parseArray(JSONObject.toJSONString(orderJson.get("detail")), OrderDetail.class); |
| | | List<OrderOtherMoney> orderOtherMoneyList = JSONArray.parseArray(JSONObject.toJSONString(orderJson.get("otherMoney")), OrderOtherMoney.class); |
| | | |
| | | boolean saveState = true; |
| | | //设置回滚点 |
| | | Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint(); |
| | |
| | | //删除其他金额明细表 |
| | | orderOtherMoneyMapper.delete(new LambdaQueryWrapper<OrderOtherMoney>().eq(OrderOtherMoney::getOrderId, order.getOrderId())); |
| | | |
| | | |
| | | //删除订单工艺表 |
| | | // orderProcessDetailMapper.delete(new LambdaQueryWrapper<OrderProcessDetail>().eq(OrderProcessDetail::getOrderId, order.getOrderId())); |
| | | insertOtherDetail(order.getOrderId(),OrderDetails,orderOtherMoneyList); |
| | |
| | | |
| | | //插入其他副表数据,被其他方法引用 |
| | | public void insertOtherDetail(String orderId,List<OrderDetail> OrderDetails,List<OrderOtherMoney> orderOtherMoneyList) { |
| | | |
| | | //先把其他金额副表的金额与数量置0 |
| | | orderOtherMoneyList.forEach(orderOtherMoney -> { |
| | | orderOtherMoney.setQuantity(0.0); |
| | |
| | | OrderDetails.get(i).setOrderId(orderId); |
| | | OrderDetails.get(i).setPerimeter(OrderDetails.get(i).getWidth()*OrderDetails.get(i).getHeight()*2/1000); |
| | | OrderDetails.get(i).setWeight(1.0); |
| | | Map<String,Double> otherColumns = JSON.parseObject(OrderDetails.get(i).getOtherColumns(), new TypeReference<Map<String, Double>>(){}); |
| | | Map<String,Object> otherColumns = JSON.parseObject(OrderDetails.get(i).getOtherColumns(), new TypeReference<Map<String, Object>>(){}); |
| | | int finalI = i; |
| | | |
| | | |
| | | if(otherColumns!=null){ |
| | | otherColumns.forEach((key, value) ->{ |
| | | if(value!=null) { |
| | | if(value!=null && key.equals("M")) { |
| | | orderOtherMoneyList.forEach(orderOtherMoney -> { |
| | | if (orderOtherMoney.getColumn().equals(key)) { |
| | | orderOtherMoney.setQuantity(orderOtherMoney.getQuantity()+(value * OrderDetails.get(finalI).getQuantity())); |
| | | orderOtherMoney.setQuantity(orderOtherMoney.getQuantity()+((Double) value * OrderDetails.get(finalI).getQuantity())); |
| | | } |
| | | }); |
| | | } |