|
|
|
@ -263,24 +263,31 @@ public class SaleorderitemController {
|
|
|
|
|
public ActionResult invoiceEntry(@PathVariable("ids") String ids) throws DataException {
|
|
|
|
|
String[] idList = ids.split(",");
|
|
|
|
|
for (String id : idList) {
|
|
|
|
|
QueryWrapper<ArinvoicesEntity> queryWrapper2 = new QueryWrapper<>();
|
|
|
|
|
queryWrapper2.lambda().eq(ArinvoicesEntity::getSalesOrderId, id);
|
|
|
|
|
ArinvoicesEntity arinvoicesEntity = arinvoicesService.getOne(queryWrapper2);
|
|
|
|
|
if (ObjectUtils.isNotEmpty(arinvoicesEntity)) {
|
|
|
|
|
QueryWrapper<SaleorderitemEntity> salesqueryWrapper = new QueryWrapper<>();
|
|
|
|
|
salesqueryWrapper.lambda().eq(SaleorderitemEntity::getId, id);
|
|
|
|
|
SaleorderitemEntity Entity = saleorderitemService.getOne(salesqueryWrapper);
|
|
|
|
|
List<ArinvoicesEntity> arinvoicesEntityList = saleorderitemService.queryArinvoicesInfo(id);
|
|
|
|
|
if (arinvoicesEntityList!=null && arinvoicesEntityList.size()>0) {
|
|
|
|
|
SaleorderitemEntity Entity = saleorderitemService.getById(id);
|
|
|
|
|
if (!Entity.getStatus().equals("2")){
|
|
|
|
|
return ActionResult.fail("数据状态不能发票录入");
|
|
|
|
|
}
|
|
|
|
|
ArinvoicesEntity arinvoicesEntity = JsonUtil.getJsonToBean(arinvoicesEntityList.get(0), ArinvoicesEntity.class);
|
|
|
|
|
QueryWrapper<Arinvoices_item0Entity> queryWrapper3 = new QueryWrapper<>();
|
|
|
|
|
queryWrapper3.lambda().eq(Arinvoices_item0Entity::getArinvoicesId,arinvoicesEntity.getId());
|
|
|
|
|
List<Arinvoices_item0Entity> list0 = arinvoices_item0Service.list(queryWrapper3);
|
|
|
|
|
QueryWrapper<Arinvoices_item1Entity> queryWrapper4 = new QueryWrapper<>();
|
|
|
|
|
queryWrapper4.lambda().eq(Arinvoices_item1Entity::getArinvoicesId,arinvoicesEntity.getId());
|
|
|
|
|
List<Arinvoices_item1Entity> list1 = arinvoices_item1Service.list(queryWrapper4);
|
|
|
|
|
arinvoicesEntity.setArinvoices_item0EntityList(list0);
|
|
|
|
|
arinvoicesEntity.setArinvoices_item1EntityList(list1);
|
|
|
|
|
if (list0!=null && list0.size()>0){
|
|
|
|
|
arinvoicesEntity.setArinvoices_item0EntityList(list0);
|
|
|
|
|
}
|
|
|
|
|
if (list1!=null && list1.size()>0){
|
|
|
|
|
for (Arinvoices_item1Entity entity : list1){
|
|
|
|
|
MaterialEntity materialEntity = materialService.getById(entity.getMaterialId());
|
|
|
|
|
if (ObjectUtils.isNotEmpty(materialEntity) && StringUtils.isNotEmpty(materialEntity.getItemName())) {
|
|
|
|
|
entity.setMaterialName(materialEntity.getItemName());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
arinvoicesEntity.setArinvoices_item1EntityList(list1);
|
|
|
|
|
}
|
|
|
|
|
return ActionResult.success(arinvoicesEntity);
|
|
|
|
|
}else {
|
|
|
|
|
List<SaleorderitemEntity> list = new ArrayList<>();
|
|
|
|
@ -293,12 +300,29 @@ public class SaleorderitemController {
|
|
|
|
|
queryWrapper1.lambda().eq(Salesorder_item0Entity::getSalesOrderId, saleorderitemEntity.getId());
|
|
|
|
|
List<Salesorder_item0Entity> dList = salesorder_item0Service.list(queryWrapper1);
|
|
|
|
|
for (Salesorder_item0Entity entity : dList) {
|
|
|
|
|
MaterialEntity materialEntity = materialService.getById(entity.getMaterialId());
|
|
|
|
|
if (ObjectUtils.isNotEmpty(materialEntity) && StringUtils.isNotEmpty(materialEntity.getItemName())){
|
|
|
|
|
entity.setMaterialName(materialEntity.getItemName());
|
|
|
|
|
}
|
|
|
|
|
QueryWrapper<PoundlistEntity> queryWrapper3 = new QueryWrapper<>();
|
|
|
|
|
queryWrapper3.lambda().eq(PoundlistEntity::getId, entity.getPoundlistId());
|
|
|
|
|
PoundlistEntity poundlistEntity = poundlistService.getOne(queryWrapper3);
|
|
|
|
|
entity.setPoundEntity(poundlistEntity);
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotEmpty(saleorderitemEntity.getCustomerId())) {
|
|
|
|
|
ContractFileEntity contractFileEntity = contractFileService.getById(saleorderitemEntity.getContractId());
|
|
|
|
|
if (ObjectUtils.isNotEmpty(contractFileEntity) && StringUtils.isNotEmpty(contractFileEntity.getContractName()));{
|
|
|
|
|
saleorderitemEntity.setContractName(contractFileEntity.getContractName());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotEmpty(saleorderitemEntity.getCustomerId())){
|
|
|
|
|
CustomerEntity customerEntity = customerService.getById(saleorderitemEntity.getCustomerId());
|
|
|
|
|
if (ObjectUtils.isNotEmpty(customerEntity) && StringUtils.isNotEmpty(customerEntity.getSupplierNm())){
|
|
|
|
|
saleorderitemEntity.setCustomerName(customerEntity.getSupplierNm());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
saleorderitemEntity.setList(dList);
|
|
|
|
|
saleorderitemEntity.setSourceName(saleorderitemEntity.getDocumentNo());
|
|
|
|
|
saleorderitemEntity.setDocumentNo(generaterSwapUtil.getBillNumber("arinvoices", false));
|
|
|
|
|
list.add(saleorderitemEntity);
|
|
|
|
|
return ActionResult.success(list);
|
|
|
|
|