|
|
|
@ -100,51 +100,27 @@ public class PoundlistController {
|
|
|
|
|
/**
|
|
|
|
|
* 生成销售
|
|
|
|
|
*
|
|
|
|
|
* @param ids
|
|
|
|
|
* @param poundlistPagination
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/createsale/{ids}")
|
|
|
|
|
public ActionResult createSale(@PathVariable("ids") String ids) throws DataException {
|
|
|
|
|
String[] idList = ids.split(",");
|
|
|
|
|
List<PoundlistEntity> list = new ArrayList<>();
|
|
|
|
|
for (String allId : idList){
|
|
|
|
|
QueryWrapper<PoundlistEntity> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
queryWrapper.lambda().eq(PoundlistEntity::getId,allId);
|
|
|
|
|
queryWrapper.lambda().eq(PoundlistEntity::getIsExamine,"1");
|
|
|
|
|
queryWrapper.lambda().eq(PoundlistEntity::getSalesStatus,"99");
|
|
|
|
|
PoundlistEntity poundlistEntity = poundlistService.getOne(queryWrapper);
|
|
|
|
|
if (ObjectUtils.isNotEmpty(poundlistEntity)) {
|
|
|
|
|
ContractFileEntity entity = contractFileService.getInfo(poundlistEntity.getSalesId());
|
|
|
|
|
if (ObjectUtils.isNotEmpty(entity) && StringUtils.isNotEmpty(entity.getContractNo())) {
|
|
|
|
|
poundlistEntity.setContractNo(entity.getContractNo());
|
|
|
|
|
poundlistEntity.setContractName(entity.getContractName());
|
|
|
|
|
}
|
|
|
|
|
CustomerEntity customerEntity = customerService.getInfo(poundlistEntity.getCustomerId());
|
|
|
|
|
if (ObjectUtils.isNotEmpty(customerEntity) && StringUtils.isNotEmpty(customerEntity.getSupplierNm())){
|
|
|
|
|
poundlistEntity.setCustomerName(customerEntity.getSupplierNm());
|
|
|
|
|
}
|
|
|
|
|
VehicleEntity vehicleEntity = vehicleService.getInfo(poundlistEntity.getVehicleId());
|
|
|
|
|
if (ObjectUtils.isNotEmpty(vehicleEntity) && StringUtils.isNotEmpty(vehicleEntity.getTicketno())){
|
|
|
|
|
poundlistEntity.setVehicleName(vehicleEntity.getTicketno());
|
|
|
|
|
}
|
|
|
|
|
MaterialEntity materialEntity = materialService.getInfo(poundlistEntity.getMaterialId());
|
|
|
|
|
if (ObjectUtils.isNotEmpty(materialEntity) && StringUtils.isNotEmpty(materialEntity.getItemName())){
|
|
|
|
|
poundlistEntity.setMaterialName(materialEntity.getItemName());
|
|
|
|
|
}
|
|
|
|
|
poundlistEntity.setDocumentNo(generaterSwapUtil.getBillNumber("salesOrder", false));
|
|
|
|
|
@PostMapping("/createsale")
|
|
|
|
|
public ActionResult createSale(@RequestBody PoundlistPagination poundlistPagination) throws DataException {
|
|
|
|
|
List<String> idList = Arrays.asList(poundlistPagination.getIds().split(","));
|
|
|
|
|
//List<PoundlistEntity> list = new ArrayList<>();
|
|
|
|
|
List<PoundlistEntity> list = poundlistService.queryCreateSale(idList);
|
|
|
|
|
for (PoundlistEntity poundlistEntity : list){
|
|
|
|
|
poundlistEntity.setRate("0");
|
|
|
|
|
if (poundlistEntity.getSalesPrice()!=null) {
|
|
|
|
|
poundlistEntity.setUnitPrice(poundlistEntity.getSalesPrice());
|
|
|
|
|
}
|
|
|
|
|
list.add(poundlistEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (PoundlistEntity list1: list){
|
|
|
|
|
String sts = list1.getPurchaseStatus();
|
|
|
|
|
String sts = poundlistEntity.getPurchaseStatus();
|
|
|
|
|
if (sts.equals("0")||sts.equals("1")||sts.equals("99")){
|
|
|
|
|
return ActionResult.fail("当前状态不能生成销售订单");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
|
list.get(0).setDocumentNo(generaterSwapUtil.getBillNumber("salesOrder", false));
|
|
|
|
|
}
|
|
|
|
|
if (list.size() > 0) {
|
|
|
|
|
long count = list.stream().map(PoundlistEntity::getSalesId).distinct().count();
|
|
|
|
|
if (count != 1) {
|
|
|
|
|