|
|
|
@ -4,10 +4,13 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
|
|
|
|
import com.logpm.basicdata.entity.BasicdataTrayEntity; |
|
|
|
|
import com.logpm.basicdata.entity.BasicdataWarehouseEntity; |
|
|
|
|
import com.logpm.basicdata.feign.IBasicdataTrayClient; |
|
|
|
|
import com.logpm.basicdata.feign.IBasicdataWarehouseClient; |
|
|
|
|
import com.logpm.warehouse.dto.TrayTypeDTO; |
|
|
|
|
import com.logpm.warehouse.dto.ZeroOrderVO; |
|
|
|
|
import com.logpm.warehouse.service.IWarehouseTaryAllocationService; |
|
|
|
|
import com.logpm.warehouse.service.IWarehouseTrayTypeService; |
|
|
|
|
import com.logpm.warehouse.vo.OrderDetailVO; |
|
|
|
|
import com.logpm.warehouse.vo.TrayTypeDataListVO; |
|
|
|
@ -36,6 +39,8 @@ public class WarehouseTrayTypeApiController {
|
|
|
|
|
|
|
|
|
|
private final IWarehouseTrayTypeService warehouseTrayTypeService; |
|
|
|
|
private final IBasicdataWarehouseClient warehouseClient; |
|
|
|
|
private final IWarehouseTaryAllocationService taryAllocationService; |
|
|
|
|
private final IBasicdataTrayClient trayClient; |
|
|
|
|
|
|
|
|
|
//----------------------订单分拣--------------------------------
|
|
|
|
|
@ResponseBody |
|
|
|
@ -1367,37 +1372,60 @@ public class WarehouseTrayTypeApiController {
|
|
|
|
|
|
|
|
|
|
for (String trayCode : trayCodes) { |
|
|
|
|
log.info(method+"当前同步的托盘 trayCode={}",trayCode); |
|
|
|
|
|
|
|
|
|
BasicdataTrayEntity trayEntity = trayClient.getTrayByTrayCode(trayCode); |
|
|
|
|
if(Objects.isNull(trayEntity)){ |
|
|
|
|
log.warn(method+"托盘信息不存在 trayCode={}",trayCode); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
Long trayId = trayEntity.getId(); |
|
|
|
|
|
|
|
|
|
Long allcationId = taryAllocationService.getAllocationIdByTrayId(trayId); |
|
|
|
|
if(!Objects.isNull(allcationId)){ |
|
|
|
|
log.warn(method+"托盘已上架 trayCode={}",trayCode); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
R trayData = warehouseTrayTypeService.findTrayData(trayCode, myCurrentWarehouse.getId()); |
|
|
|
|
int total = 0; |
|
|
|
|
Object data = trayData.getData(); |
|
|
|
|
String s = JSONObject.toJSONString(data); |
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(s); |
|
|
|
|
JSONArray packageList = jsonObject.getJSONArray("packageList"); |
|
|
|
|
JSONArray zeroOrderList = jsonObject.getJSONArray("zeroOrderList"); |
|
|
|
|
JSONArray stockOrderList = jsonObject.getJSONArray("stockOrderList"); |
|
|
|
|
int packageSize = packageList.size(); |
|
|
|
|
int zeroSize = zeroOrderList.size(); |
|
|
|
|
int stockSize = stockOrderList.size(); |
|
|
|
|
int total = packageSize+zeroSize+stockSize; |
|
|
|
|
if(!Objects.isNull(data)){ |
|
|
|
|
String s = JSONObject.toJSONString(data); |
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(s); |
|
|
|
|
JSONArray packageList = jsonObject.getJSONArray("packageList"); |
|
|
|
|
JSONArray zeroOrderList = jsonObject.getJSONArray("zeroOrderList"); |
|
|
|
|
JSONArray stockOrderList = jsonObject.getJSONArray("stockOrderList"); |
|
|
|
|
int packageSize = packageList.size(); |
|
|
|
|
int zeroSize = zeroOrderList.size(); |
|
|
|
|
int stockSize = stockOrderList.size(); |
|
|
|
|
total = packageSize+zeroSize+stockSize; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
R syncOldTrayData = warehouseTrayTypeService.findSyncOldTrayData(trayCode, myCurrentWarehouse.getId()); |
|
|
|
|
Object data1 = syncOldTrayData.getData(); |
|
|
|
|
String s1 = JSONObject.toJSONString(data1); |
|
|
|
|
JSONObject jsonObject1 = JSONObject.parseObject(s1); |
|
|
|
|
JSONArray packageList1 = jsonObject1.getJSONArray("packageList"); |
|
|
|
|
String trayType1 = jsonObject1.getString("trayType"); |
|
|
|
|
String trayCode1 = jsonObject1.getString("trayCode"); |
|
|
|
|
int size = packageList1.size(); |
|
|
|
|
if(total >= size){ |
|
|
|
|
log.warn(method+"新系统打托数量大于等于老系统 trayCode={} 不同步",trayCode); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
List<String> orderPackageCodes = new ArrayList<>(); |
|
|
|
|
for (int i = 0; i < size; i++){ |
|
|
|
|
JSONObject jsonObject2 = packageList1.getJSONObject(i); |
|
|
|
|
orderPackageCodes.add(jsonObject2.getString("orderPackageCode")); |
|
|
|
|
if(!Objects.isNull(data1)){ |
|
|
|
|
String s1 = JSONObject.toJSONString(data1); |
|
|
|
|
JSONObject jsonObject1 = JSONObject.parseObject(s1); |
|
|
|
|
JSONArray packageList1 = jsonObject1.getJSONArray("packageList"); |
|
|
|
|
String trayType1 = jsonObject1.getString("trayType"); |
|
|
|
|
String trayCode1 = jsonObject1.getString("trayCode"); |
|
|
|
|
int size = packageList1.size(); |
|
|
|
|
if(total >= size){ |
|
|
|
|
log.warn(method+"新系统打托数量大于等于老系统 trayCode={} 不同步",trayCode); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
List<String> orderPackageCodes = new ArrayList<>(); |
|
|
|
|
for (int i = 0; i < size; i++){ |
|
|
|
|
JSONObject jsonObject2 = packageList1.getJSONObject(i); |
|
|
|
|
orderPackageCodes.add(jsonObject2.getString("orderPackageCode")); |
|
|
|
|
} |
|
|
|
|
if(!orderPackageCodes.isEmpty()){ |
|
|
|
|
warehouseTrayTypeService.syncOldTrayData(trayCode1,trayType1,orderPackageCodes,myCurrentWarehouse.getId(),"同步老系统打托"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
warehouseTrayTypeService.syncOldTrayData(trayCode1,trayType1,orderPackageCodes,myCurrentWarehouse.getId(),"同步老系统打托"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return R.success("处理完成"); |
|
|
|
|