Commit 95437c43634c0611a4e8d48ca695dcc4da4e7c75
1 parent
9e2d9170
只有销售出库单和分布式调出单需要客户信息
Showing
1 changed file
with
14 additions
and
9 deletions
src/main/java/com/huaheng/api/general/service/ShipmentApiService.java
... | ... | @@ -7,6 +7,7 @@ import com.huaheng.common.constant.QuantityConstant; |
7 | 7 | import com.huaheng.common.exception.service.ServiceException; |
8 | 8 | import com.huaheng.common.utils.StringUtils; |
9 | 9 | import com.huaheng.common.utils.security.ShiroUtils; |
10 | +import com.huaheng.common.utils.spring.SpringUtils; | |
10 | 11 | import com.huaheng.framework.web.domain.AjaxResult; |
11 | 12 | import com.huaheng.pc.config.company.domain.Company; |
12 | 13 | import com.huaheng.pc.config.company.service.CompanyService; |
... | ... | @@ -95,7 +96,6 @@ public class ShipmentApiService { |
95 | 96 | return AjaxResult.error("出库子单为空"); |
96 | 97 | } |
97 | 98 | |
98 | - | |
99 | 99 | List<ShipmentHeader> shipmentHeaders = shipmentHeaderService.list(new LambdaQueryWrapper<ShipmentHeader>().eq(ShipmentHeader::getReferCode,shipmentHeader.getReferCode())); |
100 | 100 | if(shipmentHeaders.size()>0){ |
101 | 101 | for (ShipmentHeader header : shipmentHeaders) { |
... | ... | @@ -137,20 +137,27 @@ public class ShipmentApiService { |
137 | 137 | shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_HEADER_BUILD); |
138 | 138 | shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_BUILD); |
139 | 139 | shipmentHeader.setCompanyCode("BHF"); |
140 | + String saleArea=""; | |
141 | + Customer customer=null; | |
142 | + if (shipmentHeader.getShipmentType()=="XSCKD" &&shipmentHeader.getShipmentType()=="FBSTCK") { | |
143 | + customer = customerService.getOne(new LambdaQueryWrapper<Customer>().eq(Customer::getCode,shipmentHeader.getCustomerCode())); | |
144 | + if(StringUtils.isNull(customer)){ | |
145 | + return AjaxResult.error("wms此客户不存在"+shipmentHeader.getCustomerCode()); | |
146 | + } | |
147 | + saleArea= customer.getProvince() + "-" + customer.getCity() + "-" + customer.getAddress1() + "-" + customer.getAddress2(); | |
148 | + } | |
140 | 149 | |
141 | 150 | if(!shipmentHeaderService.save(shipmentHeader)){ |
142 | 151 | throw new ServiceException("保存出库主表失败"); |
143 | 152 | } |
144 | - Customer customer = customerService.getOne(new LambdaQueryWrapper<Customer>().eq(Customer::getCode,shipmentHeader.getCustomerCode())); | |
145 | - if (customer==null){ | |
146 | - return AjaxResult.error("客户不存在"); | |
147 | - } | |
148 | - String saleArea = customer.getProvince() + "-" + customer.getCity() + "-" + customer.getAddress1() + "-" + customer.getAddress2(); | |
153 | + | |
149 | 154 | //5、保存出库子表 |
150 | 155 | for(ShipmentDetail shipmentDetail : shipmentDetails){ |
151 | 156 | // shipmentDetail.setCompanyCode(customer.getAllCreditCode()); |
152 | 157 | // shipmentDetail.setCompanyName(customer.getName()); |
153 | - shipmentDetail.setAllCreditCode(customer.getAllCreditCode()); | |
158 | + if(customer!=null){ | |
159 | + shipmentDetail.setAllCreditCode(customer.getAllCreditCode()); | |
160 | + } | |
154 | 161 | shipmentDetail.setSaleArea(saleArea); |
155 | 162 | shipmentDetail.setFentity(shipmentDetail.getFentity()); |
156 | 163 | shipmentDetail.setInventorySts(QuantityConstant.GOOD); |
... | ... | @@ -166,7 +173,6 @@ public class ShipmentApiService { |
166 | 173 | shipmentDetail.setWarehouseCode("CS0001"); |
167 | 174 | // shipmentDetail.setUserDef3("0"); |
168 | 175 | } |
169 | - | |
170 | 176 | int num = 0; |
171 | 177 | List<ShipmentDetail> shipmentDetailList = new ArrayList<>(); |
172 | 178 | if(shipmentDetails.size() >500 ){ |
... | ... | @@ -272,7 +278,6 @@ public class ShipmentApiService { |
272 | 278 | if(material == null){ |
273 | 279 | return AjaxResult.error("wms没有此物料,"+shipmentDetail.getMaterialCode()); |
274 | 280 | } |
275 | - | |
276 | 281 | // if (new BigDecimal(0).compareTo(shipmentDetail.getUnitId2Qty() != null ? |
277 | 282 | // shipmentDetail.getUnitId2Qty() : new BigDecimal(0)) == 0) { |
278 | 283 | // return AjaxResult.error("数量为空"); |
... | ... |