Commit c8050e550ee18a4829c17de4deb160ec31e14c98
Merge remote-tracking branch 'origin/develop' into develop
Showing
13 changed files
with
81 additions
and
39 deletions
src/main/java/com/huaheng/pc/receipt/receiptDetail/controller/ReceiptDetailController.java
... | ... | @@ -120,7 +120,9 @@ public class ReceiptDetailController extends BaseController { |
120 | 120 | @PostMapping("/add") |
121 | 121 | @ResponseBody |
122 | 122 | public AjaxResult addSave(ReceiptDetail receiptDetail) { |
123 | - return receiptDetailService.saveReceiptDetaial(receiptDetail); | |
123 | + AjaxResult ajaxResult = receiptDetailService.saveReceiptDetaial(receiptDetail); | |
124 | + receiptDetailService.updateReceiptHeader(receiptHeaderService.getById(receiptDetail.getReceiptId())); | |
125 | + return ajaxResult; | |
124 | 126 | } |
125 | 127 | |
126 | 128 | /** |
... | ... | @@ -143,7 +145,9 @@ public class ReceiptDetailController extends BaseController { |
143 | 145 | @ResponseBody |
144 | 146 | public AjaxResult editSave( |
145 | 147 | @ApiParam(name="receiptDetail",value="入库详情") ReceiptDetail receiptDetail) { |
146 | - return receiptDetailService.updateReceiptDetaial(receiptDetail); | |
148 | + AjaxResult ajaxResult = receiptDetailService.updateReceiptDetaial(receiptDetail); | |
149 | + receiptDetailService.updateReceiptHeader(receiptHeaderService.getById(receiptDetail.getReceiptId())); | |
150 | + return ajaxResult; | |
147 | 151 | } |
148 | 152 | |
149 | 153 | /** |
... | ... | @@ -162,7 +166,11 @@ public class ReceiptDetailController extends BaseController { |
162 | 166 | for (Integer id : Convert.toIntArray(ids)){ |
163 | 167 | list.add(id); |
164 | 168 | } |
165 | - return toAjax(receiptDetailService.removeByIds(list)); | |
169 | + ReceiptDetail receiptDetail = receiptDetailService.getById(list.get(0)); | |
170 | + ReceiptHeader receiptHeader = receiptHeaderService.getById(receiptDetail.getReceiptId()); | |
171 | + AjaxResult ajaxResult = toAjax(receiptDetailService.removeByIds(list)); | |
172 | + receiptDetailService.updateReceiptHeader(receiptHeader); | |
173 | + return ajaxResult; | |
166 | 174 | } |
167 | 175 | |
168 | 176 | /** |
... | ... |
src/main/java/com/huaheng/pc/receipt/receiptDetail/service/ReceiptDetailService.java
... | ... | @@ -4,6 +4,7 @@ import com.huaheng.framework.web.domain.AjaxResult; |
4 | 4 | import com.huaheng.mobile.receipt.ReceiptBill; |
5 | 5 | import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; |
6 | 6 | import com.baomidou.mybatisplus.extension.service.IService; |
7 | +import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; | |
7 | 8 | import com.huaheng.pc.task.taskDetail.domain.TaskDetail; |
8 | 9 | |
9 | 10 | import java.util.List; |
... | ... | @@ -49,4 +50,6 @@ public interface ReceiptDetailService extends IService<ReceiptDetail>{ |
49 | 50 | AjaxResult scanReceiptCode(String code, String type, String companyCode); |
50 | 51 | |
51 | 52 | List<Integer> insertTodayReceiptDetail(int headerId, List<ReceiptBill> receiptBills, boolean isCompletedQty, String companyCode); |
53 | + | |
54 | + AjaxResult updateReceiptHeader(ReceiptHeader receiptHeader); | |
52 | 55 | } |
... | ... |
src/main/java/com/huaheng/pc/receipt/receiptDetail/service/ReceiptDetailServiceImpl.java
... | ... | @@ -35,6 +35,7 @@ import io.swagger.models.auth.In; |
35 | 35 | import org.aspectj.weaver.loadtime.Aj; |
36 | 36 | import org.springframework.stereotype.Service; |
37 | 37 | import javax.annotation.Resource; |
38 | +import java.math.BigDecimal; | |
38 | 39 | import java.util.ArrayList; |
39 | 40 | import java.util.List; |
40 | 41 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
... | ... | @@ -135,7 +136,6 @@ public class ReceiptDetailServiceImpl extends ServiceImpl<ReceiptDetailMapper, R |
135 | 136 | |
136 | 137 | //查询原记录 |
137 | 138 | ReceiptDetail originalReceiptDetail= this.getById(receiptDetail.getId()); |
138 | - ReceiptHeader receiptHeader = receiptHeaderService.getById(receiptDetail.getReceiptId()); | |
139 | 139 | //判断物料编码是否被修改 |
140 | 140 | if (!originalReceiptDetail.getMaterialCode().equals(receiptDetail.getMaterialCode())){ |
141 | 141 | LambdaQueryWrapper<Material> lambdaMaterial = Wrappers.lambdaQuery(); |
... | ... | @@ -149,11 +149,6 @@ public class ReceiptDetailServiceImpl extends ServiceImpl<ReceiptDetailMapper, R |
149 | 149 | receiptDetail.setMaterialSpec(material.getSpec()); |
150 | 150 | receiptDetail.setMaterialUnit(material.getUnit()); |
151 | 151 | receiptDetail.setProcessStamp("0"); |
152 | - receiptHeader.setTotalQty(receiptHeader.getTotalQty().subtract(originalReceiptDetail.getTotalQty())); | |
153 | - receiptHeader.setTotalLines(receiptHeader.getTotalLines()-1); | |
154 | - if ( !receiptHeaderService.updateById(receiptHeader)){ | |
155 | - return AjaxResult.error("入库头表更新失败"); | |
156 | - } | |
157 | 152 | } |
158 | 153 | } |
159 | 154 | |
... | ... | @@ -166,13 +161,29 @@ public class ReceiptDetailServiceImpl extends ServiceImpl<ReceiptDetailMapper, R |
166 | 161 | return AjaxResult.error("入库明细更新失败"); |
167 | 162 | } else { |
168 | 163 | |
169 | - receiptHeader.setTotalQty(receiptHeader.getTotalQty().add(receiptDetail.getTotalQty())); | |
170 | - receiptHeader.setTotalLines(receiptHeader.getTotalLines()+1); | |
171 | - receiptHeaderService.updateById(receiptHeader); | |
172 | 164 | return AjaxResult.success("修改单据明细成功"); |
173 | 165 | } |
174 | 166 | } |
175 | 167 | |
168 | + @Override | |
169 | + public AjaxResult updateReceiptHeader(ReceiptHeader receiptHeader) { | |
170 | + BigDecimal totalQty = new BigDecimal(0); | |
171 | + int totalLines = 0; | |
172 | + LambdaQueryWrapper<ReceiptDetail> receiptDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
173 | + receiptDetailLambdaQueryWrapper.eq(ReceiptDetail::getReceiptId,receiptHeader.getId()); | |
174 | + List<ReceiptDetail> receiptDetailList = list(receiptDetailLambdaQueryWrapper); | |
175 | + for(ReceiptDetail receiptDetail : receiptDetailList) { | |
176 | + totalLines++; | |
177 | + totalQty = totalQty.add(receiptDetail.getTotalQty()); | |
178 | + } | |
179 | + receiptHeader.setTotalQty(totalQty); | |
180 | + receiptHeader.setTotalLines(totalLines); | |
181 | + if (!receiptHeaderService.updateById(receiptHeader)){ | |
182 | + return AjaxResult.error("入库头表更新失败"); | |
183 | + } | |
184 | + return AjaxResult.success("入库头表更新成功"); | |
185 | + } | |
186 | + | |
176 | 187 | /** |
177 | 188 | * 根据流程配置更新入库明细下一流程 |
178 | 189 | * @param receiptDetail |
... | ... |
src/main/java/com/huaheng/pc/system/user/controller/IndexController.java
... | ... | @@ -104,7 +104,7 @@ public class IndexController extends BaseController |
104 | 104 | String shipmentTotal = "SELECT IFNULL(SUM(d.qty),0) 'total' from shipment_container_detail d JOIN shipment_container_header h on d.shippingContainerId = h.id WHERE DATEDIFF(NOW(), h.created) = 0 AND h.status > 19 AND h.warehouseCode = '"+ShiroUtils.getWarehouseCode()+"' ;"; |
105 | 105 | String inventoryTotal = "SELECT IFNULL(SUM(totalQty),0) 'total' from inventory_header where 1=1 " + condition; |
106 | 106 | String materialCount = "SELECT count(DISTINCT materialSkuQty) 'total' from inventory_header WHERE 1=1" + condition; |
107 | - String taskUncompletedTotal = "SELECT COUNT(*) 'total' from task_detail WHERE status < 40 " + condition; | |
107 | + String taskUncompletedTotal = "SELECT COUNT(*) 'total' from task_detail WHERE status < 100 " + condition; | |
108 | 108 | |
109 | 109 | Map<String, Object> map = new HashMap<>(); |
110 | 110 | List<LinkedHashMap<String, Object>> temp1 = mapper.selectCommon(bllCount); |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java
... | ... | @@ -752,7 +752,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
752 | 752 | .eq(InventoryDetail::getLocationCode, task.getToLocation()) |
753 | 753 | .eq(InventoryDetail::getMaterialCode, DataUtils.getString(map.get("materialCode"))) |
754 | 754 | .eq(InventoryDetail::getContainerCode, DataUtils.getString(map.get("containerCode"))) |
755 | - .eq(InventoryDetail::getContainerCode, DataUtils.getString(map.get("batch"))); | |
755 | + .eq(InventoryDetail::getBatch, DataUtils.getString(map.get("batch"))) | |
756 | + .eq(InventoryDetail::getLot, DataUtils.getString(map.get("lot"))) | |
757 | + .eq(InventoryDetail::getProjectNo, DataUtils.getString(map.get("projectNo"))) | |
758 | + .eq(InventoryDetail::getCompanyCode, DataUtils.getString(map.get("companyCode"))); | |
756 | 759 | InventoryDetail detail = inventoryDetailService.getOne(inventory); |
757 | 760 | if (detail == null) { |
758 | 761 | //库存明细添加 |
... | ... | @@ -770,6 +773,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
770 | 773 | detail.setReceiptDetailId(DataUtils.getInteger(map.get("receiptDetailId")));//入库单明细ID |
771 | 774 | detail.setBatch(DataUtils.getString(map.get("batch")));//批次 |
772 | 775 | detail.setLot(DataUtils.getString(map.get("lot")));//批号 |
776 | + detail.setProjectNo(DataUtils.getString(map.get("projectNo")));//项目号 | |
773 | 777 | detail.setInventorySts(DataUtils.getString(map.get("inventorySts")));//库存状态 |
774 | 778 | // detail.setManufactureDate(new SimpleDateFormat("yyyy-MM-dd").parse(map.get("manufactureDate").toString()));//生产日期 |
775 | 779 | // detail.setExpirationDate(new SimpleDateFormat("yyyy-MM-dd").parse(map.get("expirationDate").toString()));//失效日期 |
... | ... | @@ -907,21 +911,33 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
907 | 911 | List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventory); |
908 | 912 | for(int i=0; i < inventoryDetailList.size() -1; i++) { |
909 | 913 | for(int j = inventoryDetailList.size() - 1; j > i; j--) { |
910 | - if(inventoryDetailList.get(i).getMaterialCode().equals(inventoryDetailList.get(j).getMaterialCode())) { | |
914 | + InventoryDetail inventoryDetail = inventoryDetailList.get(i); | |
915 | + InventoryDetail inventoryDetail2 = inventoryDetailList.get(j); | |
916 | + if(inventoryDetail.getMaterialCode().equals(inventoryDetail2.getMaterialCode()) | |
917 | + && inventoryDetail.getBatch().equals(inventoryDetail2.getBatch()) | |
918 | + && inventoryDetail.getLot().equals(inventoryDetail2.getLot()) | |
919 | + && inventoryDetail.getProjectNo().equals(inventoryDetail2.getProjectNo())) { | |
911 | 920 | BigDecimal totalQty = inventoryDetailList.get(i).getQty().add(inventoryDetailList.get(j).getQty()); |
912 | 921 | inventoryDetailList.get(i).setQty(totalQty); |
913 | - inventoryDetailList.remove(j); | |
914 | 922 | LambdaQueryWrapper<InventoryDetail> wrapper = Wrappers.lambdaQuery(); |
915 | 923 | wrapper.eq(InventoryDetail::getId, inventoryDetailList.get(i).getId()); |
916 | 924 | inventoryDetailService.update(inventoryDetailList.get(i), wrapper); |
925 | + LambdaQueryWrapper<InventoryDetail> wrapper2 = Wrappers.lambdaQuery(); | |
926 | + wrapper2.eq(InventoryDetail::getId, inventoryDetailList.get(j).getId()); | |
927 | + inventoryDetailService.remove(wrapper2); | |
928 | + inventoryDetailList.remove(j); | |
917 | 929 | } |
918 | 930 | } |
919 | 931 | } |
920 | 932 | BigDecimal totalQty = new BigDecimal(0); |
933 | + int totalLines = 0; | |
921 | 934 | for(InventoryDetail inventoryDetail : inventoryDetailList) { |
922 | 935 | totalQty = totalQty.add(inventoryDetail.getQty()); |
936 | + totalLines++; | |
923 | 937 | } |
924 | 938 | header.setTotalQty(totalQty); |
939 | + header.setTotalLines(totalLines); | |
940 | + header.setContainerStatus("some"); | |
925 | 941 | LambdaQueryWrapper<InventoryHeader> wrapper = Wrappers.lambdaQuery(); |
926 | 942 | wrapper.eq(InventoryHeader::getId, header.getId()); |
927 | 943 | inventoryHeaderService.update(header, wrapper); |
... | ... | @@ -1593,6 +1609,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1593 | 1609 | taskDetail.setFromLocation(task.getFromLocation()); |
1594 | 1610 | taskDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); |
1595 | 1611 | taskDetail.setBatch(item.getBatch()); |
1612 | + taskDetail.setProjectNo(item.getProjectNo()); | |
1596 | 1613 | if (containerCapacity != null) { |
1597 | 1614 | conatinQty += (int) Math.floor(item.getQty().intValue() / containerCapacity.getQty().intValue()); |
1598 | 1615 | taskDetail.setContainQty((int) Math.floor(item.getQty().intValue() / containerCapacity.getQty().intValue())); |
... | ... |
src/main/resources/application.yml
src/main/resources/mybatis/task/TaskHeaderMapper.xml
... | ... | @@ -48,7 +48,7 @@ |
48 | 48 | SELECT rd.id receiptDetailId,rd.receiptId,td.taskId, td.warehouseCode, td.id taskDetailId, td.status, |
49 | 49 | td.containerCode, td.qty, td.materialCode,rd.totalQty,td.materialSpec, |
50 | 50 | rd.receiptCode,rd.inventorySts, |
51 | - td.materialName, rd.batch, rd.lot, | |
51 | + td.materialName, rd.batch, rd.lot, rd.projectNo, | |
52 | 52 | rd.manufactureDate, rd.expirationDate |
53 | 53 | FROM task_detail td |
54 | 54 | INNER JOIN receipt_detail rd ON rd.id = td.billDetailId AND td.taskId = #{taskId,jdbcType=INTEGER} |
... | ... |
src/main/resources/templates/config/company/add.html
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 | <html lang="zh" xmlns:th="http://www.thymeleaf.org"> |
3 | 3 | <meta charset="utf-8"> |
4 | 4 | <head th:include="include :: header"></head> |
5 | +<link href="/ajax/libs/iCheck/custom.css" th:href="@{/ajax/libs/iCheck/custom.css}" rel="stylesheet"/> | |
5 | 6 | <body class="white-bg"> |
6 | 7 | <div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
7 | 8 | <form class="form-horizontal m" id="form-company-add"> |
... | ... |
src/main/resources/templates/config/company/edit.html
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 | <html lang="zh" xmlns:th="http://www.thymeleaf.org"> |
3 | 3 | <meta charset="utf-8"> |
4 | 4 | <head th:include="include :: header"></head> |
5 | +<link href="/ajax/libs/iCheck/custom.css" th:href="@{/ajax/libs/iCheck/custom.css}" rel="stylesheet"/> | |
5 | 6 | <body class="white-bg"> |
6 | 7 | <div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
7 | 8 | <form class="form-horizontal m" id="form-company-edit" th:object="${company}"> |
... | ... |
src/main/resources/templates/inventory/inventoryDetail/inventoryDetail.html
... | ... | @@ -164,6 +164,18 @@ |
164 | 164 | title: '库存数量' |
165 | 165 | }, |
166 | 166 | { |
167 | + field: 'batch', | |
168 | + title: '批次', | |
169 | + }, | |
170 | + { | |
171 | + field: 'lot', | |
172 | + title: '批号', | |
173 | + }, | |
174 | + { | |
175 | + field: 'projectNo', | |
176 | + title: '项目号', | |
177 | + }, | |
178 | + { | |
167 | 179 | field: 'inventorySts', |
168 | 180 | title: '库存状态', |
169 | 181 | align: 'center', |
... | ... | @@ -211,23 +223,6 @@ |
211 | 223 | } |
212 | 224 | }, |
213 | 225 | { |
214 | - field: 'batch', | |
215 | - title: '批次', | |
216 | - sortable: false, | |
217 | - visible: false | |
218 | - }, | |
219 | - { | |
220 | - field: 'lot', | |
221 | - title: '批号', | |
222 | - sortable: false, | |
223 | - visible: false | |
224 | - }, | |
225 | - { | |
226 | - field: 'projectNo', | |
227 | - title: '项目号', | |
228 | - sortable: true | |
229 | - }, | |
230 | - { | |
231 | 226 | field: 'supplierCode', |
232 | 227 | title: '供应商编码', |
233 | 228 | visible: true |
... | ... |
src/main/resources/templates/receipt/receiptDetail/add.html
... | ... | @@ -174,7 +174,7 @@ |
174 | 174 | "materialCode": $("input[name='materialCode']").val(), |
175 | 175 | "batch": $("input[name='batch']").val(), |
176 | 176 | "lot": $("input[name='lot']").val(), |
177 | - "project": $("input[name='project']").val(), | |
177 | + "projectNo": $("input[name='projectNo']").val(), | |
178 | 178 | "manufactureDate": $("input[name='manufactureDate']").val(), |
179 | 179 | "expirationDate": $("input[name='expirationDate']").val(), |
180 | 180 | "inventorySts": $("#inventorySts option:selected").val(), |
... | ... |
src/main/resources/templates/receipt/receiptDetail/receiptDetail.html
src/main/resources/templates/receipt/receiptHeader/receiptHeader.html