Browse Source

Merge branch 'dev' into pre-production

single_db
汤建军 1 year ago
parent
commit
299059d89f
  1. 40
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataDriverArteryController.java
  2. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionSignforAppController.java
  3. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListMapper.xml
  4. 5
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSignforService.java
  5. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  6. 6
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java
  7. 449
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java
  8. 35
      blade-service/logpm-patch/src/main/java/com/logpm/patch/controller/SyncServiceTypeController.java
  9. 16
      blade-service/logpm-patch/src/main/java/com/logpm/patch/mapper/SyncServiceTypeMapper.java
  10. 21
      blade-service/logpm-patch/src/main/java/com/logpm/patch/mapper/SyncServiceTypeMapper.xml
  11. 14
      blade-service/logpm-patch/src/main/java/com/logpm/patch/service/ISyncServiceTypeService.java
  12. 48
      blade-service/logpm-patch/src/main/java/com/logpm/patch/service/impl/SyncServiceTypeServiceImpl.java

40
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataDriverArteryController.java

@ -52,6 +52,8 @@ import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -198,6 +200,7 @@ public class BasicdataDriverArteryController extends BladeController {
/**
* 导出数据
* http://localhost:8400/driverArtery/export-basicdataDriverArtery
*/
@GetMapping("/export-basicdataDriverArtery")
@ApiOperationSupport(order = 9)
@ -222,4 +225,41 @@ public class BasicdataDriverArteryController extends BladeController {
return R.success("操作成功");
}
/**
* 导出数据模板
* http://localhost:8400/driverArtery/export-basicdataDriverArteryMb
*/
@GetMapping("/export-basicdataDriverArteryMb")
@ApiOperationSupport(order = 10)
@ApiOperation(value = "导出数据模板", notes = "传入basicdataDriverArtery")
public void exportBasicdataDriverArteryMb(@ApiIgnore @RequestParam Map<String, Object> basicdataDriverArtery, BladeUser bladeUser, HttpServletResponse response) {
List<BasicdataDriverArteryImproterExcel> list = new ArrayList<>();
//存入模板
BasicdataDriverArteryImproterExcel excel = new BasicdataDriverArteryImproterExcel();
excel.setName("张三");
excel.setPhone("13812345678");
excel.setType("1");
excel.setJobType("1");
excel.setDrivingType("1");
excel.setBindVehicle("川A12345,川B56789");
excel.setContractStartTime(new Date());
excel.setContractEndTime(new Date());
excel.setIdCard("440123198012345678");
excel.setGender("1");
excel.setWarehouseName("龙泉仓");
excel.setResidentialAddress("四川省成都市龙泉驿区车城东六路");
excel.setBankType("1");
excel.setBankCardNub("1234567890123456789");
excel.setDriverLicenseNub("A123456789");
excel.setDriverLicenseOrgan("四川省成都市市公安局交警支队");
excel.setDriverLicenseStartTime(new Date());
excel.setDriverLicenseEndTime(new Date());
excel.setEmployeeQualificationNub("A987654321");
excel.setRoadOperationLicenseNub("B123456789");
excel.setCarrierName("汇通运输");
excel.setTransportationAgreement("运输协议123");
excel.setNotes("这是备注信息");
list.add(excel);
ExcelUtil.export(response, "司机信息数据模板" + DateUtil.time(), "司机信息数据模板表", list, BasicdataDriverArteryImproterExcel.class);
}
}

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionSignforAppController.java

@ -231,7 +231,7 @@ public class DistributionSignforAppController {
@ApiOperation(value = "司机一键签收", notes = "传入distributionSignfor")
public R oneclick(@Valid @RequestBody DistributionSignforDTO distributionSignfor) {
distributionSignfor.setIsClerk(false);
R r = distributionSignforService.oneclick(distributionSignfor);
R r = distributionSignforService.oneclickPDA(distributionSignfor);
List<String> packageCodes = (List<String>)r.getData();
try{
String orderPackageCodes = null;

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListMapper.xml

@ -452,7 +452,7 @@
FROM
logpm_distribution_stock_list ldsl
<where>
ldsl.service_type = #{par.serviceType} and ldsl.warehouse_id = #{par.warehouseId} and ldsl.is_deleted = 0
ldsl.service_type = #{par.serviceType} and ldsl.warehouse_id = #{par.warehouseId} and ldsl.is_deleted = 0 and (ldsl.quantity_stock - ldsl.quantity_occupied) > 0
<if test="par.incomingBatch != null and par.incomingBatch != ''">
and ldsl.incoming_batch like concat('%',#{par.incomingBatch},'%')
</if>

5
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSignforService.java

@ -138,6 +138,11 @@ public interface IDistributionSignforService extends BaseService<DistributionSig
* 签收管理 一键签收
*/
R oneclick(DistributionSignforDTO distributionSignfor);
/**
* 签收管理PDA 一键签收
*/
R oneclickPDA(DistributionSignforDTO distributionSignfor);
/**
* 签收管理 离线签收
*/

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java

@ -6110,7 +6110,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
for (String id : idArray) {
//查询对应配送单
DistributionDeliveryListEntity deliveryListEntity = baseMapper.selectById(id);//配送单
DistributionDeliveryListEntity deliveryListEntity = baseMapper.selectById(Long.parseLong(id));//配送单
if (Objects.isNull(deliveryListEntity)) {
log.warn("#########handleShangPeiData: 配送单信息不存在 deliveryListEntityId={}", id);
throw new CustomerException(403, "配送单信息不存在");

6
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java

@ -1823,7 +1823,11 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
if (Func.isEmpty(oleInventoryList.get(c))) {
mallName.add(distributionStockListDTO.getMarketName());
mallId.add(distributionStockListDTO.getMarketId());
DistributionStockListEntity stockListEntity = distributionStockListService.getById(distributionStockListDTO.getId());
int keyongshuliang = stockListEntity.getQuantityStock() - stockListEntity.getQuantityOccupied();
if (distributionStockListDTO.getReservationNum() > keyongshuliang) {
throw new RuntimeException("库存品库内数量不足!!!");
}
//新增库存品
reservationStocklistEntity.setStocklistId(distributionStockListDTO.getId());
reservationStocklistEntity.setReservationId(id);

449
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java

@ -3180,6 +3180,455 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
//维护配送信息
distributionDeliveryListService.maintenanceDeliveryInfo(distributionSignforEntity.getDeliveryId());
return R.status(true);
} @Override
@Transactional
public R oneclickPDA(DistributionSignforDTO distributionSignfor) {
BladeUser user = AuthUtil.getUser();
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse();
if (Objects.isNull(myCurrentWarehouse)) {
return R.fail(403,"仓库信息不能为空");
// throw new CustomerException(403, "仓库信息不能为/**/空");
}
// ------------------------------------2023-09-08 一键签收调整------------------------------------------
//1、查询本次一键签收操作是否有效 ---- > 这里一件签收针对的就是制定的任务下的包件和库存品
// 无效 -- > 直接提示该次操作无效 无效的场景快速点击操作两次签收的动作,司机已经进行了所有的包件签收扫描但是还未进行签收确认的动作
// 有效 -- >
// 查询该车次任务中装车的包件和库存品 此时一键签收就需要将该车次中的所有包件和库存品都进行签收
// 此时考虑多种场景:
// 1、存在库存品 库存品未进行备货操作无法进行一件装车,但是对于已备货的库存品可以进行装车
// 2、多个车次的配送任务进行一件签收状态、在没有进行装车操作的时候
//
// 3、对于已经装车的库存品或者包件在一件签收的时候需要进行过滤
// Map<String, List<DistributionSignPrintDTO>> map = distributionSignfor.getMap();
// if (Func.isEmpty(map)){
// log.error("#############无图片信息:{}", map);
// return R.fail("无图片信息");
// }
this.updatePicture(distributionSignfor);
//2、维护状态
DistributionReservationEntity reservationEntity = distributionReservationMapper.selectById(distributionSignfor.getReservationId());
if (Func.isEmpty(reservationEntity)) {
log.error("#############reservationEntity参数错误:{}", reservationEntity);
return R.fail("服务器正忙~~");
}
//查询数据
DistributionSignforEntity distributionSignforEntity = baseMapper.selectOne(new QueryWrapper<DistributionSignforEntity>().lambda()
.eq(DistributionSignforEntity::getDeliveryId, distributionSignfor.getDeliveryId())
.eq(DistributionSignforEntity::getReservationId, distributionSignfor.getReservationId())
);
//获取计划配送用户司机
DistributionDeliveryListEntity distributionDeliveryListEntity = distributionDeliveryListMapper.selectById(distributionSignfor.getDeliveryId());
if (Func.isEmpty(distributionDeliveryListEntity)) {
log.error("#############deliveryId参数错误:{}", distributionSignfor.getDeliveryId());
return R.fail("服务器正忙~~");
}
DistributionDeliverySelfEntity distributionDeliverySelfEntity = null;
if (distributionDeliveryListEntity.getKind().equals("1")) {
//自主
distributionDeliverySelfEntity = distributionDeliverySelfMapper.selectOne(new QueryWrapper<DistributionDeliverySelfEntity>().lambda()
.eq(DistributionDeliverySelfEntity::getIsMaster, 2)
.eq(DistributionDeliverySelfEntity::getDeliveryId, distributionSignfor.getDeliveryId())
);
} else {
//三方
DistributionDeliveryTripartiteEntity distributionDeliveryTripartiteEntity = distributionDeliveryTripartiteMapper.selectOne(new QueryWrapper<DistributionDeliveryTripartiteEntity>().lambda()
.eq(DistributionDeliveryTripartiteEntity::getDeliveryId, distributionSignfor.getDeliveryId())
);
distributionDeliverySelfEntity = Func.copy(distributionDeliveryTripartiteEntity, DistributionDeliverySelfEntity.class);
// BeanUtils.copyProperties(distributionDeliveryTripartiteEntity, distributionDeliverySelfEntity);
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (Func.equals(distributionSignforEntity.getDriverSigning(), SignforDriverSigningStatusConstant.yiqianshou.getValue())) {
log.error("###############重复签收+{" + distributionSignforEntity + "}");
return R.fail("签收失败");
}
//处理库存品
//查询出该客户下的库存品信息
List<DisStockListDetailEntity> detailEntities = distributionReservationMapper.selectInventoryListByReservation(distributionSignforEntity.getReservationId());
if (detailEntities.size() > 0 && Func.isNotEmpty(detailEntities)) {
boolean flag = detailEntities.stream().allMatch(s -> Func.isNotEmpty(s.getStockPackageCode()));
//只要库存品没有进行备货操作则不能进行一件装车操作
if (flag) {
for (DisStockListDetailEntity detailEntity : detailEntities) {
DistributionLoadscaninvnEntity loadscaninvnEntity = distributionLoadscaninvnService.getOne(Wrappers.<DistributionLoadscaninvnEntity>query().lambda()
.eq(DistributionLoadscaninvnEntity::getReservationId, detailEntity.getReservationId())
.eq(DistributionLoadscaninvnEntity::getInventoryId, detailEntity.getStockListId())
.eq(DistributionLoadscaninvnEntity::getOrderPackageCode, detailEntity.getStockPackageCode())
.eq(DistributionLoadscaninvnEntity::getInventoryPackageId, detailEntity.getId())
.ne(DistributionLoadscaninvnEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())
);
if (Func.isNotEmpty(loadscaninvnEntity)) {
if (!loadscaninvnEntity.getSignforState().equals(LoadScanSigningStatusConstant.yiqianshou.getValue())) {
//存在库存品装车数据,这里进行签收状态修改
loadscaninvnEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue());
loadscaninvnEntity.setReceivedQuantity(detailEntity.getNum());
loadscaninvnEntity.setOneClick(1);
loadscaninvnEntity.setOneQclick(2);
loadscaninvnEntity.setSigningUser(user.getNickName());
loadscaninvnEntity.setSigningUserId(user.getUserId());
loadscaninvnEntity.setReceivedQuantity(detailEntity.getNum());
loadscaninvnEntity.setSigningTime(simpleDateFormat.format(new Date()));
distributionLoadscaninvnService.updateById(loadscaninvnEntity);
Integer i = distributionDeliveryListMapper.updateloadingTimeById(distributionDeliveryListEntity.getId());
Integer j = distributionSignforMapper.updatesignforByinvn(loadscaninvnEntity.getDeliveryId(), loadscaninvnEntity.getReservationId(), loadscaninvnEntity.getPackageNub());
//更新签收人
Integer m = distributionSignforMapper.updateSignUser(loadscaninvnEntity.getDeliveryId(), loadscaninvnEntity.getReservationId(), AuthUtil.getUser());
distributionAsyncService.checkSignStatus(null, loadscaninvnEntity.getReservationId(), loadscaninvnEntity.getDeliveryId());
}
} else {
//不存在装车数据 这里需要进行装车数据的补录
detailEntity.setStockLockingStatus(InventoryLoadingStatusConstant.yizhuangche.getValue());
detailEntity.setStockSignfoStatus(InventorySigningStatusConstant.yiqianshou.getValue());
disStockListDetailService.updateById(detailEntity);
DistributionLoadscaninvnEntity newLoadscaninvnEntity = new DistributionLoadscaninvnEntity();
if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverId())) {
newLoadscaninvnEntity.setDriverId(distributionDeliverySelfEntity.getDriverId());
}
if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverName())) {
newLoadscaninvnEntity.setDriverName(distributionDeliverySelfEntity.getDriverName());
}
if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleId())) {
newLoadscaninvnEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId());
}
if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleNub())) {
newLoadscaninvnEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub());
}
if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverPhone())) {
newLoadscaninvnEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone());
}
newLoadscaninvnEntity.setLoadingId(distributionDeliverySelfEntity.getId().toString());
newLoadscaninvnEntity.setOrderPackageCode(detailEntity.getStockPackageCode());
newLoadscaninvnEntity.setInventoryId(detailEntity.getStockListId());
newLoadscaninvnEntity.setDeliveryId(distributionSignforEntity.getDeliveryId());
newLoadscaninvnEntity.setReservationId(distributionSignforEntity.getReservationId());
newLoadscaninvnEntity.setInventoryPackageId(detailEntity.getId());
newLoadscaninvnEntity.setScanUser(user.getNickName());
newLoadscaninvnEntity.setScanTime(simpleDateFormat.format(new Date()));
newLoadscaninvnEntity.setPackageNub(detailEntity.getNum());
newLoadscaninvnEntity.setScanStatus(LoadingStatusConstant.yijianzhuangche.getValue());
newLoadscaninvnEntity.setIsInsert(LoadingIsInsertConstant.bulu.getValue());
newLoadscaninvnEntity.setScanType("1");
newLoadscaninvnEntity.setType(2);
newLoadscaninvnEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue());
newLoadscaninvnEntity.setIsSignfor(1);
newLoadscaninvnEntity.setReceivedQuantity(detailEntity.getNum());
newLoadscaninvnEntity.setOneClick(2);
newLoadscaninvnEntity.setOneQclick(2);
newLoadscaninvnEntity.setSigningUser(user.getNickName());
newLoadscaninvnEntity.setSigningUserId(user.getUserId());
newLoadscaninvnEntity.setSigningTime(simpleDateFormat.format(new Date()));
if (distributionSignfor.getIsClerk()) {
newLoadscaninvnEntity.setMsg("文员一键签收数据补录");
} else {
newLoadscaninvnEntity.setMsg("司机一键签收数据补录");
}
distributionLoadscaninvnService.save(newLoadscaninvnEntity);
Integer i = distributionDeliveryListMapper.updateloadingTimeById(distributionDeliveryListEntity.getId());
//更新签收表的签收数量和装车数量
Integer j = distributionSignforMapper.updateLoadAndsignforByinvn(newLoadscaninvnEntity.getDeliveryId(), newLoadscaninvnEntity.getReservationId(), newLoadscaninvnEntity.getPackageNub());
//更新签收人
Integer m = distributionSignforMapper.updateSignUser(newLoadscaninvnEntity.getDeliveryId(), newLoadscaninvnEntity.getReservationId(), AuthUtil.getUser());
//维护预约库存品数据
//扣减库存
DistributionStockListEntity stockListEntity = distributionStockListService.getById(detailEntity.getStockListId());
stockListEntity.setQuantityOccupied(stockListEntity.getQuantityOccupied() - newLoadscaninvnEntity.getPackageNub());
stockListEntity.setQuantityStock(stockListEntity.getQuantityStock() - newLoadscaninvnEntity.getPackageNub());
stockListEntity.setOutboundQuantity(stockListEntity.getOutboundQuantity() + newLoadscaninvnEntity.getPackageNub());
distributionStockListService.updateById(stockListEntity);
distributionAsyncService.checkSignStatus(null, newLoadscaninvnEntity.getReservationId(), newLoadscaninvnEntity.getDeliveryId());
}
}
} else {
log.error("################库存品未进行备货操作+{}" , detailEntities);
return R.fail("库存品未进行备货操作");
}
}
//查询出该签收任务下的客户对应的所有包件和库存品信息
List<DistributionParcelListEntity> parcelListEntityList = distributionReservationMapper.selectPackageListByReservationId(distributionSignforEntity.getReservationId());
//包件不需要考虑备货、装车直接可进行签收 过滤已装车的包件
// List<DistributionParcelListEntity> noLoadingPackage = parcelListEntityList.stream().filter(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue())).collect(Collectors.toList());
//查询该客户下的所有零担信息
List<DistributionParcelNumberDTO> parcelNumberEntityList = distributionReservationMapper.selectZeroPackageListByReservationId(distributionSignforEntity.getReservationId());
if (Func.isNotEmpty(parcelNumberEntityList)) {
for (DistributionParcelNumberDTO parcelNumberEntity : parcelNumberEntityList) {
DistributionLoadscanEntity distributionLoadscanEntity = distributionLoadscanService.getOne(Wrappers.<DistributionLoadscanEntity>query().lambda().eq(DistributionLoadscanEntity::getReservationId, distributionSignforEntity.getReservationId()).eq(DistributionLoadscanEntity::getPackageId, parcelNumberEntity.getParcelListId()).ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()));
if (Func.isNotEmpty(distributionLoadscanEntity)) {
//情况列举:
// 1、装车件数未按照计划数量
// 2、装车件数齐套,签收数量未签收
// 3、部分签收
// 4、完成签收
//不论什么情况均进行一次重新签收维护数量
DistributionParcelNumberEntity distributionParcelNumberEntity = distributionParcelNumberService.getById(parcelNumberEntity.getId());
BigDecimal signinQuantity = new BigDecimal(distributionParcelNumberEntity.getSigninQuantity());
BigDecimal reservationNum = new BigDecimal(parcelNumberEntity.getReservationNum());
BigDecimal deliveryQuantity = new BigDecimal(distributionParcelNumberEntity.getDeliveryQuantity());
BigDecimal handQuantity = new BigDecimal(distributionParcelNumberEntity.getHandQuantity());
BigDecimal outboundQuantity = new BigDecimal(distributionParcelNumberEntity.getOutboundQuantity());
BigDecimal loadedQuantity = new BigDecimal(distributionLoadscanEntity.getLoadedNub());
BigDecimal receivedQuantity = new BigDecimal(distributionLoadscanEntity.getReceivedQuantity());
if (distributionLoadscanEntity.getSignforState().equals(LoadScanSigningStatusConstant.yiqianshou.getValue())) {
//装车数量和签收数量只会一样,
if (distributionLoadscanEntity.getReceivedQuantity() > 0) {
distributionParcelNumberEntity.setSigninQuantity(signinQuantity.add(reservationNum).subtract(receivedQuantity).intValue());
distributionParcelNumberEntity.setHandQuantity(handQuantity.add(receivedQuantity).subtract(reservationNum).intValue());
distributionParcelNumberEntity.setOutboundQuantity(outboundQuantity.add(reservationNum).subtract(receivedQuantity).intValue());
distributionParcelNumberEntity.setDeliveryQuantity(deliveryQuantity.add(receivedQuantity).subtract(reservationNum).intValue());
distributionParcelNumberService.updateById(distributionParcelNumberEntity);
} else {
log.error("################扫描签收零担订单数量为0:{}", distributionLoadscanEntity);
return Resp.scanFail("服务器正忙...", "请稍后重试");
}
} else if (distributionLoadscanEntity.getSignforState().equals(LoadScanSigningStatusConstant.weiqianshou.getValue())) {
if (distributionLoadscanEntity.getLoadedNub() .equals(parcelNumberEntity.getReservationNum()) ) {
//装车数量和计划数量一致,这里进行签收数量的维护
//修改这里装车数量已经维护好了,只需要维护签收数量
distributionParcelNumberEntity.setSigninQuantity(signinQuantity.add(reservationNum).intValue());
distributionParcelNumberService.updateById(distributionParcelNumberEntity);
} else {
if (distributionLoadscanEntity.getLoadedNub() > 0) {
distributionParcelNumberEntity.setSigninQuantity(signinQuantity.add(reservationNum).intValue());
distributionParcelNumberEntity.setHandQuantity(handQuantity.add(loadedQuantity).subtract(reservationNum).intValue());
distributionParcelNumberEntity.setOutboundQuantity(outboundQuantity.add(reservationNum).subtract(loadedQuantity).intValue());
distributionParcelNumberEntity.setDeliveryQuantity(deliveryQuantity.add(loadedQuantity).subtract(reservationNum).intValue());
distributionParcelNumberService.updateById(distributionParcelNumberEntity);
}
}
} else {
log.error("##################扫描签收状态异常:{}", distributionLoadscanEntity.getId());
throw new RuntimeException("服务器正忙...");
}
distributionLoadscanEntity.setReceivedQuantity(parcelNumberEntity.getReservationNum());
distributionLoadscanEntity.setLoadedNub(parcelNumberEntity.getReservationNum());
distributionLoadscanEntity.setPackageNub(parcelNumberEntity.getReservationNum());
distributionLoadscanEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue());
if (distributionSignfor.getIsClerk()) {
distributionLoadscanEntity.setMsg("文员一键签收数据补录");
} else {
distributionLoadscanEntity.setMsg("司机一键签收数据补录");
}
distributionLoadscanService.updateById(distributionLoadscanEntity);
distributionAsyncService.checkSignStatus(distributionLoadscanEntity.getPackageId(), distributionLoadscanEntity.getReservationId(), distributionLoadscanEntity.getDeliveryId());
//更新签收人
Integer m = distributionSignforMapper.updateSignUser(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), AuthUtil.getUser());
//维护签收数量
DistributionSignforEntity signforEntity = distributionSignforMapper.selectOne(Wrappers.<DistributionSignforEntity>query().lambda().eq(DistributionSignforEntity::getDeliveryId, distributionLoadscanEntity.getDeliveryId()).eq(DistributionSignforEntity::getReservationId, distributionLoadscanEntity.getReservationId()));
BigDecimal loadedNumber = new BigDecimal(signforEntity.getLoadedNumber());
BigDecimal signingReceivedQuantity = new BigDecimal(signforEntity.getReceivedQuantity());
signforEntity.setLoadedNumber(loadedNumber.subtract(loadedQuantity).add(reservationNum).intValue());
signforEntity.setReceivedQuantity(signingReceivedQuantity.subtract(receivedQuantity).add(reservationNum).intValue());
distributionSignforMapper.updateById(signforEntity);
} else {
//不存在装车数据
DistributionLoadscanEntity loadscanEntity = new DistributionLoadscanEntity();
loadscanEntity.setPackageId(parcelNumberEntity.getParcelListId());
loadscanEntity.setOrderId(parcelNumberEntity.getStockArticleId());
loadscanEntity.setDeliveryId(distributionSignforEntity.getDeliveryId());
loadscanEntity.setReservationId(distributionSignforEntity.getReservationId());
loadscanEntity.setScanUser(user.getNickName());
loadscanEntity.setScanTime(simpleDateFormat.format(new Date()));
loadscanEntity.setPackageNub(parcelNumberEntity.getReservationNum());
loadscanEntity.setLoadedNub(parcelNumberEntity.getReservationNum());
loadscanEntity.setSigningUser(user.getUserName());
loadscanEntity.setSigningUserId(user.getUserId());
if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverId())) {
loadscanEntity.setDriverId(distributionDeliverySelfEntity.getDriverId());
}
if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverName())) {
loadscanEntity.setDriverName(distributionDeliverySelfEntity.getDriverName());
}
if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleId())) {
loadscanEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId());
}
if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleNub())) {
loadscanEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub());
}
if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverPhone())) {
loadscanEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone());
}
loadscanEntity.setLoadingId(distributionDeliverySelfEntity.getId().toString());
loadscanEntity.setScanStatus(LoadingStatusConstant.yijianzhuangche.getValue());
loadscanEntity.setIsInsert(LoadingIsInsertConstant.bulu.getValue());
loadscanEntity.setScanType("1");
loadscanEntity.setType(2);
loadscanEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue());
loadscanEntity.setIsSignfor(1);
loadscanEntity.setReceivedQuantity(parcelNumberEntity.getReservationNum());
loadscanEntity.setOneClick(2);
loadscanEntity.setOneQclick(2);
loadscanEntity.setSigningTime(simpleDateFormat.format(new Date()));
if (distributionSignfor.getIsClerk()) {
loadscanEntity.setMsg("文员一键签收数据补录");
} else {
loadscanEntity.setMsg("司机一键签收数据补录");
}
distributionLoadscanService.save(loadscanEntity);
distributionAsyncService.checkSignStatus(loadscanEntity.getPackageId(), loadscanEntity.getReservationId(), loadscanEntity.getDeliveryId());
Integer i = distributionDeliveryListMapper.updateloadingTimeById(distributionDeliveryListEntity.getId());
//更新签收表的签收数量和装车数量
Integer j = distributionSignforMapper.updateSignforByReservationId(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), loadscanEntity.getPackageNub());
//更新签收人
Integer m = distributionSignforMapper.updateSignUser(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), AuthUtil.getUser());
//维护出库数量和签收数量
DistributionParcelNumberEntity parcelNumberServiceById = distributionParcelNumberService.getById(parcelNumberEntity.getId());
BigDecimal signinQuantity = new BigDecimal(parcelNumberServiceById.getSigninQuantity());
BigDecimal reservationNum = new BigDecimal(parcelNumberEntity.getReservationNum());
BigDecimal deliveryQuantity = new BigDecimal(parcelNumberServiceById.getDeliveryQuantity());
BigDecimal handQuantity = new BigDecimal(parcelNumberServiceById.getHandQuantity());
BigDecimal outboundQuantity = new BigDecimal(parcelNumberServiceById.getOutboundQuantity());
parcelNumberServiceById.setSigninQuantity(signinQuantity.add(reservationNum).intValue());
parcelNumberServiceById.setDeliveryQuantity(deliveryQuantity.subtract(reservationNum).intValue());
parcelNumberServiceById.setOutboundQuantity(outboundQuantity.add(reservationNum).intValue());
parcelNumberServiceById.setHandQuantity(handQuantity.subtract(reservationNum).intValue());
distributionParcelNumberService.updateById(parcelNumberServiceById);
}
}
}
String signingTime = simpleDateFormat.format(new Date());
List<Long> packageIds = new ArrayList<>();
List<String> orderCodes = new ArrayList<>();
if (Func.isNotEmpty(parcelListEntityList)) {
for (DistributionParcelListEntity parcelListEntity : parcelListEntityList) {
//查询是否进行装车
DistributionLoadscanEntity loadscanEntities = distributionLoadscanService.getOne(Wrappers.<DistributionLoadscanEntity>query().lambda()
.eq(DistributionLoadscanEntity::getPackageId, parcelListEntity.getId())
.eq(DistributionLoadscanEntity::getDeliveryId, distributionSignforEntity.getDeliveryId())
.eq(DistributionLoadscanEntity::getReservationId, distributionSignforEntity.getReservationId())
.ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()));
parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue());
parcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.yiqianshou.getValue());
if (Func.isEmpty(loadscanEntities)) {
//没有进行过装车操作
DistributionLoadscanEntity loadscanEntity = new DistributionLoadscanEntity();
loadscanEntity.setPackageId(parcelListEntity.getId());
loadscanEntity.setOrderPackageCode(parcelListEntity.getOrderPackageCode());
loadscanEntity.setOrderId(parcelListEntity.getStockArticleId());
loadscanEntity.setDeliveryId(distributionSignforEntity.getDeliveryId());
loadscanEntity.setReservationId(distributionSignforEntity.getReservationId());
loadscanEntity.setScanUser(user.getNickName());
loadscanEntity.setScanTime(signingTime);
loadscanEntity.setPackageNub(parcelListEntity.getQuantity());
loadscanEntity.setSigningUser(user.getNickName());
loadscanEntity.setSigningUserId(user.getUserId());
if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverId())) {
loadscanEntity.setDriverId(distributionDeliverySelfEntity.getDriverId());
}
if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverName())) {
loadscanEntity.setDriverName(distributionDeliverySelfEntity.getDriverName());
}
if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleId())) {
loadscanEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId());
}
if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleNub())) {
loadscanEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub());
}
if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverPhone())) {
loadscanEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone());
}
loadscanEntity.setLoadingId(distributionDeliverySelfEntity.getId().toString());
loadscanEntity.setScanStatus(LoadingStatusConstant.yijianzhuangche.getValue());
loadscanEntity.setIsInsert(LoadingIsInsertConstant.bulu.getValue());
loadscanEntity.setScanType("1");
loadscanEntity.setType(2);
loadscanEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue());
loadscanEntity.setIsSignfor(1);
loadscanEntity.setReceivedQuantity(parcelListEntity.getQuantity());
loadscanEntity.setOneClick(2);
loadscanEntity.setOneQclick(2);
loadscanEntity.setSigningTime(signingTime);
if (distributionSignfor.getIsClerk()) {
loadscanEntity.setMsg("文员一键签收数据补录");
} else {
loadscanEntity.setMsg("司机一键签收数据补录");
}
distributionLoadscanService.save(loadscanEntity);
Integer i = distributionDeliveryListMapper.updateloadingTimeById(distributionDeliveryListEntity.getId());
//更新签收表的签收数量和装车数量
Integer j = distributionSignforMapper.updateSignforByReservationId(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), loadscanEntity.getPackageNub());
//扣减订单的在库数量
Integer k = distributionStockArticleMapper.deductionHandQuantity(loadscanEntity.getOrderId(), loadscanEntity.getLoadedNub());
//更新签收人
Integer m = distributionSignforMapper.updateSignUser(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), AuthUtil.getUser());
} else {
//存在装车数据
if (distributionSignfor.getIsClerk()) {
loadscanEntities.setMsg("文员一键签收数据补录");
} else {
loadscanEntities.setMsg("司机一键签收数据补录");
}
if (!loadscanEntities.getSignforState().equals(LoadScanSigningStatusConstant.yiqianshou.getValue())) {
//已经进行过装车 这里不需要进行订制品订单在库数量扣减
loadscanEntities.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue());
loadscanEntities.setReceivedQuantity(parcelListEntity.getQuantity());
loadscanEntities.setOneClick(1);
loadscanEntities.setOneQclick(2);
loadscanEntities.setSigningUser(user.getNickName());
loadscanEntities.setSigningUserId(user.getUserId());
loadscanEntities.setReceivedQuantity(parcelListEntity.getQuantity());
loadscanEntities.setSigningTime(signingTime);
distributionLoadscanService.updateById(loadscanEntities);
Integer i = distributionDeliveryListMapper.updateloadingTimeById(distributionDeliveryListEntity.getId());
//更新签收数量
Integer j = distributionSignforMapper.updateSignforNum(loadscanEntities.getDeliveryId(), loadscanEntities.getReservationId(), loadscanEntities.getPackageNub());
//更新签收人
Integer m = distributionSignforMapper.updateSignUser(loadscanEntities.getDeliveryId(), loadscanEntities.getReservationId(), AuthUtil.getUser());
distributionAsyncService.checkSignStatus(loadscanEntities.getPackageId(), loadscanEntities.getReservationId(), loadscanEntities.getDeliveryId());
}
}
distributionAsyncService.sendFactory(parcelListEntity,simpleDateFormat.format(new Date()), reservationEntity.getId(), reservationEntity.getReservationCode(), myCurrentWarehouse.getName(),user.getNickName());
packageIds.add(parcelListEntity.getId());
orderCodes.add(parcelListEntity.getOrderCode());
}
//批量维护订单信息
if (Func.isNotEmpty(orderCodes)){
String orderCode = orderCodes.stream().distinct().collect(Collectors.joining(","));
distributionStockArticleService.maintenanceOrderInfo(orderCode,myCurrentWarehouse.getId());
}
if (Func.isNotEmpty(packageIds)) {
distributionAsyncService.handlPakcage(packageIds, myCurrentWarehouse.getId());
//批量推送
distributionAsyncService.sendReviewFactory(distributionSignforEntity.getId(),myCurrentWarehouse.getName() ,myCurrentWarehouse.getId());
}
}
//维护客户信息状态
reservationEntity.setLoadingStatus(ReservationLoadingStatusConstant.yizhuangche.getValue());
reservationEntity.setSigningStatus(ReservationSigningStatusConstant.yiqianshou.getValue());
distributionReservationMapper.updateById(reservationEntity);
//维护签收状态
// distributionAsyncService.checkDeliverySignStatusByReservation(distributionSignforEntity.getDeliveryId());
// distributionDeliveryListEntity.setDeliveryListLoadingStatus(ReservationLoadingStatusConstant.yizhuangche.getValue());
// if (distributionSignfor.getIsClerk()) {
// distributionDeliveryListEntity.setDeliveryStatus(DeliveryStatusConstant.peisongzhong.getValue());
// } else {
// distributionDeliveryListEntity.setDeliveryStatus(DeliveryStatusConstant.yiwancheng.getValue());
// }
// distributionDeliveryListMapper.updateById(distributionDeliveryListEntity);
LambdaUpdateWrapper<DistributionSignforEntity> set = new UpdateWrapper<DistributionSignforEntity>().lambda()
.eq(DistributionSignforEntity::getId, distributionSignforEntity.getId())
.set(StringUtils.isNotBlank(distributionSignfor.getDeliverySignPictures()), DistributionSignforEntity::getDeliverySignPictures, distributionSignfor.getDeliverySignPictures())
.set(StringUtils.isNotBlank(distributionSignfor.getSigningType()), DistributionSignforEntity::getSigningType, distributionSignfor.getSigningType())
.set(DistributionSignforEntity::getDriverSigning, 2)
.set(!distributionSignfor.getIsClerk() && StringUtils.isNotBlank(distributionSignfor.getDriverRemarks()), DistributionSignforEntity::getDriverRemarks, distributionSignfor.getDriverRemarks())
.set(DistributionSignforEntity::getDriverSigning, 2);
boolean update = this.update(set);
//维护配送信息
return R.status(true);
}

35
blade-service/logpm-patch/src/main/java/com/logpm/patch/controller/SyncServiceTypeController.java

@ -0,0 +1,35 @@
package com.logpm.patch.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.patch.dto.SyncInventoryDTO;
import com.logpm.patch.entity.SyncInventoryEntity;
import com.logpm.patch.service.ISyncServiceTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
/*
* logisticsplatform-service
* @Author Diss
* @Create 2024/1/15 12:30
*/
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping("/syncServiceType")
@Api(value = "同步订单信息控制器", tags = "同步订单信息接口")
public class SyncServiceTypeController {
private final ISyncServiceTypeService syncServiceTypeService;
@ResponseBody
@PostMapping("/change")
@ApiOperation(value = "分页", notes = "传入运单号,仓库名称,商店名称")
public R change(@RequestParam String id, @RequestParam String warehouseName, @RequestParam String mallName) {
syncServiceTypeService.syncServiceType(id, warehouseName, mallName);
return R.success("修改成功");
}
}

16
blade-service/logpm-patch/src/main/java/com/logpm/patch/mapper/SyncServiceTypeMapper.java

@ -0,0 +1,16 @@
package com.logpm.patch.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/*
* logisticsplatform-service
* @Author Diss
* @Create 2024/1/15 14:46
*/
@Mapper
public interface SyncServiceTypeMapper {
void syncServiceTypeByMallName(@Param("stockArticleId")Long stockArticleId, @Param("mallName")String mallName);
void syncServiceTypeByWarehouseName(@Param("stockArticleId")Long stockArticleId, @Param("warehouseName") String warehouseName);
}

21
blade-service/logpm-patch/src/main/java/com/logpm/patch/mapper/SyncServiceTypeMapper.xml

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.logpm.patch.mapper.SyncServiceTypeMapper">
<update id="syncServiceTypeByMallName">
UPDATE logpm_distribution_stock_article ldsa
LEFT JOIN logpm_basicdata_client lbc ON lbc.client_name = #{mallName} AND lbc.is_deleted = 0
LEFT JOIN logpm_basicdata_store_business lbsb ON lbsb.client_id = lbc.id
SET ldsa.mall_id = COALESCE(lbc.id, ldsa.mall_id),
ldsa.mall_code = COALESCE(lbc.client_code, ldsa.mall_code),
ldsa.mall_name = COALESCE(lbc.client_name, ldsa.mall_name),
ldsa.type_service = COALESCE(lbsb.type_service, ldsa.type_service),
ldsa.consignee_unit = #{mallName}
WHERE ldsa.id = #{stockArticleId};
</update>
<update id="syncServiceTypeByWarehouseName">
</update>
</mapper>

14
blade-service/logpm-patch/src/main/java/com/logpm/patch/service/ISyncServiceTypeService.java

@ -0,0 +1,14 @@
package com.logpm.patch.service;
/*
* logisticsplatform-service
* @Author Diss
* @Create 2024/1/15 13:57
*/
import org.springframework.web.bind.annotation.RequestParam;
public interface ISyncServiceTypeService {
void syncServiceType( String id, String warehouseName, String shopName) ;
}

48
blade-service/logpm-patch/src/main/java/com/logpm/patch/service/impl/SyncServiceTypeServiceImpl.java

@ -0,0 +1,48 @@
package com.logpm.patch.service.impl;
/*
* logisticsplatform-service
* @Author Diss
* @Create 2024/1/15 14:04
*/
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.feign.IDistributionParcelListClient;
import com.logpm.patch.controller.SyncServiceTypeController;
import com.logpm.patch.mapper.SyncServiceTypeMapper;
import com.logpm.patch.service.ISyncServiceTypeService;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springblade.core.log.exception.ServiceException;
import org.springframework.stereotype.Service;
import java.util.Objects;
@Log4j2
@Service
@AllArgsConstructor
public class SyncServiceTypeServiceImpl implements ISyncServiceTypeService {
private final IDistributionParcelListClient distributionParcelListClient;
private final SyncServiceTypeMapper syncServiceTypeMapper;
@Override
public void syncServiceType(String id, String warehouseName, String mallName) {
DistributionParcelListEntity distributionParcelListEntity = distributionParcelListClient.findByOrderPackageCodeAndStatus(id);
if (distributionParcelListEntity==null){
throw new ServiceException("订单号不存在");
}
Long stockArticleId = distributionParcelListEntity.getStockArticleId();
//判断那个是仓库名称和商店名称谁是null
if (Objects.isNull(warehouseName) || warehouseName.isEmpty()){
//用订单和商店名称来操作 //修改商场名称 id code 服务类型 收货单位
syncServiceTypeMapper.syncServiceTypeByMallName(stockArticleId,mallName);
}else if(Objects.isNull(mallName) || mallName.isEmpty()){
//用订单号和仓库名称来操作
syncServiceTypeMapper.syncServiceTypeByWarehouseName(stockArticleId,warehouseName);
}else {
throw new ServiceException("请传入仓库名称或商店名称");
}
}
}
Loading…
Cancel
Save