@ -16,20 +16,32 @@ import jnpf.base.vo.DownloadVO;
import jnpf.base.vo.PageListVO ;
import jnpf.base.vo.PaginationVO ;
import jnpf.config.ConfigValueUtil ;
import jnpf.contractfile.entity.ContractFileEntity ;
import jnpf.contractfile.service.ContractFileService ;
import jnpf.exception.DataException ;
import jnpf.materialvo.entity.MaterialEntity ;
import jnpf.materialvo.service.MaterialService ;
import jnpf.mobilePort.utils.FileCopy ;
import jnpf.payment.model.payment.PaymentListVO ;
import jnpf.payment.service.PaymentService ;
import jnpf.poundlist.entity.PoundlistEntity ;
import jnpf.poundlist.service.PoundlistService ;
import jnpf.purchaseback.entity.PurchasebackEntity ;
import jnpf.purchaseback.entity.PurchaseorderEntity ;
import jnpf.purchaseback.service.PurchasebackService ;
import jnpf.purchaseback.service.PurchaseorderService ;
import jnpf.purchaseorder.entity.* ;
import jnpf.purchaseorder.model.purchaseorder.* ;
import jnpf.purchaseorder.service.* ;
import jnpf.reservoirarea.entity.ReservoirareaEntity ;
import jnpf.reservoirarea.service.ReservoirareaService ;
import jnpf.util.* ;
import jnpf.util.enums.FileTypeEnum ;
import jnpf.util.file.UploadUtil ;
import jnpf.warehouse.service.WareHouseService ;
import lombok.Cleanup ;
import lombok.extern.slf4j.Slf4j ;
import org.apache.commons.lang3.StringUtils ;
import org.apache.poi.hssf.usermodel.HSSFWorkbook ;
import org.apache.poi.ss.usermodel.Workbook ;
import org.springframework.beans.factory.annotation.Autowired ;
@ -71,10 +83,12 @@ public class PurchaseorderController {
@Autowired
private UserProvider userProvider ;
@Autowired
private PaymentService paymentService ;
@Autowired
private PurchaseorderitemService purchaseorderitemService ;
@Autowired
private PurchasebackService purchasebackService ;
@Autowired
private Purchaseorder_item0Service purchaseorder_item0Service ;
@Autowired
@ -91,7 +105,16 @@ public class PurchaseorderController {
private InvoicesitemService invoicesitemService ;
@Autowired
private PurchaseorderService purchaseorderService ;
@Autowired
private PoundlistService poundlistService ;
@Autowired
private MaterialService materialService ;
@Autowired
private ReservoirareaService reservoirareaService ;
@Autowired
private WareHouseService wareHouseService ;
@Autowired
private ContractFileService contractFileService ;
/ * *
* 归 档
@ -106,6 +129,11 @@ public class PurchaseorderController {
if ( purchaseorder . getInvoiceAmount ( ) . equals ( purchaseorder . getAmount ( ) ) & & purchaseorder . getInvoiceAmount ( ) . equals ( purchaseorder . getPayPrice ( ) ) ) {
purchaseorder . setStatus ( "3" ) ;
purchaseorderitemService . updateById ( purchaseorder ) ;
List < PoundlistEntity > poundlistEntityList = purchaseorderitemService . getPoundList ( purchaseorder . getId ( ) ) ;
for ( PoundlistEntity poundlistEntity : poundlistEntityList ) {
poundlistEntity . setPurchaseStatus ( "3" ) ;
poundlistService . updateById ( poundlistEntity ) ;
}
return ActionResult . success ( "归档成功!" ) ;
} else {
return ActionResult . fail ( "发票金额、金额、已付款金额三者不一致!" ) ;
@ -155,15 +183,15 @@ public class PurchaseorderController {
List < PurchaseorderitemEntity > list = purchaseorderitemService . getList ( purchaseorderPagination ) ;
//处理id字段转名称, 若无需转或者为空可删除
for ( PurchaseorderitemEntity entity : list ) {
Map < String , Object > contractNameMap = new HashMap < > ( ) ;
entity . setContractName ( generaterSwapUtil . getPopupSelectValue ( "390143765857220229" , "contract_name" , "contract_name" , entity . getContractName ( ) , contractNameMap ) ) ;
Map < String , Object > contractCodeMap = new HashMap < > ( ) ;
entity . setContractName ( generaterSwapUtil . getPopupSelectValue ( "390143765857220229" , "id" , "contract_name" , entity . getContractCode ( ) , contractCodeMap ) ) ;
Map < String , Object > supplierIdMap = new HashMap < > ( ) ;
entity . setSupplierName ( generaterSwapUtil . getPopupSelectValue ( "397751667988199621" , "id" , "supplier_name" , entity . getSupplierId ( ) , supplierIdMap ) ) ;
entity . setCreatorUserName ( generaterSwapUtil . userSelectValue ( entity . getCreatorUserName ( ) ) ) ;
}
List < PurchaseorderListVO > listVO = JsonUtil . getJsonToList ( list , PurchaseorderListVO . class ) ;
for ( PurchaseorderListVO purchaseorderVO : listVO ) {
}
PageListVO vo = new PageListVO ( ) ;
vo . setList ( listVO ) ;
PaginationVO page = JsonUtil . getJsonToBean ( purchaseorderPagination , PaginationVO . class ) ;
@ -186,15 +214,23 @@ public class PurchaseorderController {
purchaseorderCrForm . setDocumentNo ( generaterSwapUtil . getBillNumber ( "cgdj" , false ) ) ;
purchaseorderCrForm . setCreatorUserName ( userInfo . getUserId ( ) ) ;
purchaseorderCrForm . setCreatorTime ( DateUtil . getNow ( ) ) ;
purchaseorderCrForm . setStatus ( "0" ) ; //待开票
purchaseorderCrForm . setSourceSystem ( "0" ) ; //人工创建
purchaseorderCrForm . setIsSettle ( "0" ) ; //未结算
purchaseorderCrForm . setIsTransfer ( "0" ) ; //未转销售
PurchaseorderitemEntity entity = JsonUtil . getJsonToBean ( purchaseorderCrForm , PurchaseorderitemEntity . class ) ;
entity . setId ( mainId ) ;
entity . setStatus ( null ) ;
purchaseorderitemService . save ( entity ) ;
List < Purchaseorder_item0Entity > Purchaseorder_item0List = JsonUtil . getJsonToList ( purchaseorderCrForm . getPurchaseorder_item0List ( ) , Purchaseorder_item0Entity . class ) ;
for ( Purchaseorder_item0Entity entitys : Purchaseorder_item0List ) {
entitys . setId ( RandomUtil . uuId ( ) ) ;
entitys . setPurchaseorderId ( entity . getId ( ) ) ;
purchaseorder_item0Service . save ( entitys ) ;
PoundlistEntity poundlistEntity = poundlistService . getById ( entitys . getPoundlistId ( ) ) ;
poundlistEntity . setSettlement ( entitys . getSettlement ( ) ) ;
poundlistEntity . setPurchasePrice ( entitys . getPrice ( ) ) ;
poundlistEntity . setPurchaseStatus ( "0" ) ;
poundlistService . updateById ( poundlistEntity ) ;
}
//
// List<Invoices_item0itemEntity> Invoices_item0itemList = JsonUtil.getJsonToList(purchaseorderCrForm.getInvoices_item0itemList(),Invoices_item0itemEntity.class);
@ -225,7 +261,7 @@ public class PurchaseorderController {
// collectionpoService.save(entitys);
// }
return ActionResult . success ( "创建成功" ) ;
}
}
@ -458,6 +494,32 @@ public class PurchaseorderController {
}
/ * *
* 批 量 查 询 采 购 订 单 信 息
*
* @param ids
* @return
* /
@GetMapping ( "/batchQueryPurchaseorder/{ids}" )
@Transactional
public ActionResult < List < PurchaseorderitemEntity > > batchQueryPurchaseorder ( @PathVariable ( "ids" ) String ids ) {
List < PurchaseorderitemEntity > list = new ArrayList < > ( ) ;
String [ ] idList = ids . split ( "," ) ;
for ( String id : idList ) {
PurchaseorderitemEntity entity = purchaseorderitemService . getInfo ( id ) ;
List < PoundlistEntity > poundlistEntityList = purchaseorderitemService . getPoundList ( id ) ;
entity . setPoundlistEntityList ( poundlistEntityList ) ;
if ( entity ! = null & & StringUtils . isNotEmpty ( entity . getContractCode ( ) ) ) {
ContractFileEntity contractFileEntity = contractFileService . getById ( entity . getContractCode ( ) ) ;
if ( contractFileEntity ! = null & & StringUtils . isNotEmpty ( contractFileEntity . getContractName ( ) ) ) {
entity . setContractNo ( contractFileEntity . getContractCode ( ) ) ;
}
}
list . add ( entity ) ;
}
return ActionResult . success ( list ) ;
}
/ * *
* 信 息
*
@ -476,6 +538,16 @@ public class PurchaseorderController {
//子表
List < Purchaseorder_item0Entity > Purchaseorder_item0List = purchaseorderitemService . GetPurchaseorder_item0List ( id ) ;
for ( Purchaseorder_item0Entity purchaseorder_item0Entity : Purchaseorder_item0List ) {
if ( StringUtils . isNotEmpty ( purchaseorder_item0Entity . getMaterialId ( ) ) ) {
MaterialEntity materialEntity = materialService . getById ( purchaseorder_item0Entity . getMaterialId ( ) ) ;
if ( materialEntity ! = null & & StringUtils . isNotEmpty ( materialEntity . getInArea ( ) ) ) {
purchaseorder_item0Entity . setReservoirareaId ( materialEntity . getInArea ( ) ) ;
ReservoirareaEntity reservoirareaEntity = reservoirareaService . getById ( materialEntity . getInArea ( ) ) ;
if ( reservoirareaEntity ! = null & & StringUtils . isNotEmpty ( reservoirareaEntity . getWarehouseId ( ) ) ) {
purchaseorder_item0Entity . setWarehouseId ( reservoirareaEntity . getWarehouseId ( ) ) ;
}
}
}
}
vo . setPurchaseorder_item0List ( JsonUtil . getJsonToList ( Purchaseorder_item0List , Purchaseorder_item0Model . class ) ) ;
QueryWrapper < InvoicesitemEntity > invoicesitemWrapper = new QueryWrapper < > ( ) ;
@ -489,22 +561,12 @@ public class PurchaseorderController {
for ( Invoices_item0itemEntity invoices_item0itemEntity : Invoices_item0itemList ) {
}
vo . setInvoices_item0itemList ( JsonUtil . getJsonToList ( Invoices_item0itemList , Invoices_item0itemModel . class ) ) ;
QueryWrapper < PaymentdocpoEntity > PaymentdocpoWrapper = new QueryWrapper < > ( ) ;
PaymentdocpoWrapper . lambda ( ) . eq ( PaymentdocpoEntity : : getPurchaseOrderNo , entity . getDocumentNo ( ) ) ;
List < PaymentdocpoEntity > paymentdocList = paymentdocpoService . list ( PaymentdocpoWrapper ) ;
List < PaymentitemEntity > PaymentitemList = new ArrayList < > ( ) ;
for ( PaymentdocpoEntity paymentdocpoEntity : paymentdocList ) {
List < PaymentitemEntity > paymentitemlist = purchaseorderitemService . GetPaymentitemList ( paymentdocpoEntity . getDocumentNo ( ) ) ;
PaymentitemList . addAll ( paymentitemlist ) ;
}
for ( PaymentitemEntity paymentitemEntity : PaymentitemList ) {
}
vo . setPaymentList ( JsonUtil . getJsonToList ( PaymentitemList , PaymentListVO . class ) ) ;
List < PurchasebackitemEntity > PurchasebackitemList = purchaseorderitemService . GetPurchasebackitemList ( id ) ;
for ( PurchasebackitemEntity purchasebackitemEntity : PurchasebackitemList ) {
}
vo . setPurchasebackList ( JsonUtil . getJsonToList ( PurchasebackitemList , PurchasebackEntity . class ) ) ;
List < PaymentListVO > paymentList = paymentService . queryByPurchaseorderId ( id ) ;
vo . setPaymentList ( paymentList ) ;
QueryWrapper < PurchasebackEntity > purchasebackWrapper = new QueryWrapper < > ( ) ;
purchasebackWrapper . lambda ( ) . eq ( PurchasebackEntity : : getPurchaseOrderId , id ) ;
List < PurchasebackEntity > PurchasebackList = purchasebackService . list ( purchasebackWrapper ) ;
vo . setPurchasebackList ( PurchasebackList ) ;
List < CollectionpoEntity > CollectionitemList = purchaseorderitemService . GetCollectionitemList ( entity . getDocumentNo ( ) ) ;
for ( CollectionpoEntity collectionpoEntity : CollectionitemList ) {
}
@ -513,6 +575,20 @@ public class PurchaseorderController {
return ActionResult . success ( vo ) ;
}
/ * *
* 归 档
*
* @param id
* @return
* /
@GetMapping ( "guidang/{id}" )
public ActionResult < PurchaseorderInfoVO > guidang ( @PathVariable ( "id" ) String id ) {
PurchaseorderitemEntity entity = purchaseorderitemService . getInfo ( id ) ;
entity . setStatus ( "3" ) ;
purchaseorderitemService . updateById ( entity ) ;
return ActionResult . success ( "归档成功" ) ;
}
/ * *
* 表 单 信 息 ( 详 情 页 )
*
@ -528,15 +604,17 @@ public class PurchaseorderController {
List < Purchaseorder_item0Entity > jg_purchaseorder_item0List = purchaseorderitemService . GetPurchaseorder_item0List ( id ) ;
List < Purchaseorder_item0Model > jg_purchaseorder_item0ModelList = JsonUtil . getJsonToList ( jg_purchaseorder_item0List , Purchaseorder_item0Model . class ) ;
for ( Purchaseorder_item0Model jg_purchaseorder_item0Model : jg_purchaseorder_item0ModelList ) {
// Map<String,Object> licenseNumMap = new HashMap<>();
// jg_purchaseorder_item0Model.setLicenseNum(generaterSwapUtil.getPopupSelectValue("389754644018016581","license_no","license_no",jg_purchaseorder_item0Model.getLicenseNum(),licenseNumMap));
Map < String , Object > vehicleIdMap = new HashMap < > ( ) ;
jg_purchaseorder_item0Model . setVehicleId ( generaterSwapUtil . getPopupSelectValue ( "389754644018016581" , "vehicle_id" , "ticketno" , jg_purchaseorder_item0Model . getVehicleId ( ) , vehicleIdMap ) ) ;
Map < String , Object > materialIdMap = new HashMap < > ( ) ;
jg_purchaseorder_item0Model . setMaterialId ( generaterSwapUtil . getPopupSelectValue ( "397736371898382533" , "id" , "item_name" , jg_purchaseorder_item0Model . getMaterialId ( ) , materialIdMap ) ) ;
}
vo . setPurchaseorder_item0List ( jg_purchaseorder_item0ModelList ) ;
// List<Invoices_item0itemEntity> jg_invoices_item0List = purchaseorderitemService.GetInvoices_item0itemList(id);
// List<Invoices_item0itemModel> jg_invoices_item0ModelList = JsonUtil.getJsonToList(jg_invoices_item0List,Invoices_item0itemModel.class);
// for(Invoices_item0itemModel jg_invoices_item0Model : jg_invoices_item0ModelList){
// }
// vo.setInvoices_item0itemList(jg_invoices_item0ModelList);
List < Invoices_item0itemEntity > jg_invoices_item0List = purchaseorderitemService . GetInvoices_item0itemList ( id ) ;
List < Invoices_item0itemModel > jg_invoices_item0ModelList = JsonUtil . getJsonToList ( jg_invoices_item0List , Invoices_item0itemModel . class ) ;
for ( Invoices_item0itemModel jg_invoices_item0Model : jg_invoices_item0ModelList ) {
}
vo . setInvoices_item0itemList ( jg_invoices_item0ModelList ) ;
QueryWrapper < InvoicesitemEntity > invoicesitemWrapper = new QueryWrapper < > ( ) ;
invoicesitemWrapper . lambda ( ) . eq ( InvoicesitemEntity : : getPurchaseorderId , id ) ;
@ -550,34 +628,17 @@ public class PurchaseorderController {
}
vo . setInvoices_item0itemList ( JsonUtil . getJsonToList ( Invoices_item0itemList , Invoices_item0itemModel . class ) ) ;
// List<PaymentitemEntity> jg_paymentList = purchaseorderitemService.GetPaymentitemList(id);
// List<PaymentitemModel> jg_paymentModelList = JsonUtil.getJsonToList(jg_paymentList,PaymentitemModel.class);
// for(PaymentitemModel jg_paymentModel : jg_paymentModelList){
// }
// vo.setPaymentitemList(jg_paymentModelList);
QueryWrapper < PaymentdocpoEntity > PaymentdocpoWrapper = new QueryWrapper < > ( ) ;
PaymentdocpoWrapper . lambda ( ) . eq ( PaymentdocpoEntity : : getPurchaseOrderNo , entity . getDocumentNo ( ) ) ;
List < PaymentdocpoEntity > paymentdocList = paymentdocpoService . list ( PaymentdocpoWrapper ) ;
List < PaymentitemEntity > PaymentitemList = new ArrayList < > ( ) ;
for ( PaymentdocpoEntity paymentdocpoEntity : paymentdocList ) {
List < PaymentitemEntity > paymentitemlist = purchaseorderitemService . GetPaymentitemList ( paymentdocpoEntity . getDocumentNo ( ) ) ;
PaymentitemList . addAll ( paymentitemlist ) ;
}
for ( PaymentitemEntity paymentitemEntity : PaymentitemList ) {
}
vo . setPaymentList ( JsonUtil . getJsonToList ( PaymentitemList , PaymentListVO . class ) ) ;
List < PurchasebackitemEntity > jg_purchasebackList = purchaseorderitemService . GetPurchasebackitemList ( id ) ;
List < PurchasebackEntity > jg_purchasebackModelList = JsonUtil . getJsonToList ( jg_purchasebackList , PurchasebackEntity . class ) ;
for ( PurchasebackEntity jg_purchasebackModel : jg_purchasebackModelList ) {
List < PaymentListVO > paymentList = paymentService . queryByPurchaseorderId ( id ) ;
vo . setPaymentList ( paymentList ) ;
QueryWrapper < PurchasebackEntity > purchasebackWrapper = new QueryWrapper < > ( ) ;
purchasebackWrapper . lambda ( ) . eq ( PurchasebackEntity : : getPurchaseOrderId , id ) ;
List < PurchasebackEntity > PurchasebackList = purchasebackService . list ( purchasebackWrapper ) ;
vo . setPurchasebackList ( PurchasebackList ) ;
List < CollectionpoEntity > jg_collectionList = purchaseorderitemService . GetCollectionitemList ( id ) ;
List < CollectionitemModel > jg_collectionModelList = JsonUtil . getJsonToList ( jg_collectionList , CollectionitemModel . class ) ;
for ( CollectionitemModel jg_collectionModel : jg_collectionModelList ) {
}
vo . setPurchasebackList ( jg_purchasebackModelList ) ;
// List<CollectionpoEntity> jg_collectionList = purchaseorderitemService.GetCollectionitemList(id);
// List<CollectionitemModel> jg_collectionModelList = JsonUtil.getJsonToList(jg_collectionList,CollectionitemModel.class);
// for(CollectionitemModel jg_collectionModel : jg_collectionModelList){
// }
// vo.setCollectionitemList(jg_collectionModelList);
vo . setCollectionitemList ( jg_collectionModelList ) ;
List < CollectionpoEntity > CollectionitemList = purchaseorderitemService . GetCollectionitemList ( entity . getDocumentNo ( ) ) ;
for ( CollectionpoEntity collectionpoEntity : CollectionitemList ) {
@ -587,8 +648,10 @@ public class PurchaseorderController {
//附表数据转换
//添加到详情表单对象中
Map < String , Object > contractNameMap = new HashMap < > ( ) ;
// vo.setContractName(generaterSwapUtil.getPopupSelectValue("390143765857220229","contract_name","contract_name",vo.getContractName(),contractNameMap));
Map < String , Object > contractCodeMap = new HashMap < > ( ) ;
vo . setContractCode ( generaterSwapUtil . getPopupSelectValue ( "390143765857220229" , "id" , "contract_name" , vo . getContractCode ( ) , contractCodeMap ) ) ;
Map < String , Object > supplierIdMap = new HashMap < > ( ) ;
vo . setSupplierId ( generaterSwapUtil . getPopupSelectValue ( "397751667988199621" , "id" , "supplier_name" , vo . getSupplierId ( ) , supplierIdMap ) ) ;
vo . setCreatorUserName ( generaterSwapUtil . userSelectValue ( vo . getCreatorUserName ( ) ) ) ;
return ActionResult . success ( vo ) ;
@ -638,6 +701,11 @@ public class PurchaseorderController {
entitys . setId ( RandomUtil . uuId ( ) ) ;
entitys . setPurchaseorderId ( entity . getId ( ) ) ;
purchaseorder_item0Service . save ( entitys ) ;
PoundlistEntity poundlistEntity = poundlistService . getById ( entitys . getPoundlistId ( ) ) ;
poundlistEntity . setSettlement ( entitys . getSettlement ( ) ) ;
poundlistEntity . setPurchasePrice ( entitys . getPrice ( ) ) ;
poundlistService . updateById ( poundlistEntity ) ;
}
QueryWrapper < Invoices_item0itemEntity > Invoices_item0itemqueryWrapper = new QueryWrapper < > ( ) ;
Invoices_item0itemqueryWrapper . lambda ( ) . eq ( Invoices_item0itemEntity : : getPurchaseorderId , entity . getId ( ) ) ;
@ -659,12 +727,12 @@ public class PurchaseorderController {
paymentitemService . remove ( queryWrapper ) ;
}
List < PaymentitemEntity > PaymentitemList = JsonUtil . getJsonToList ( purchaseorderUpForm . getPayment List( ) , PaymentitemEntity . class ) ;
/ * List < PaymentitemEntity > PaymentitemList = JsonUtil . getJsonToList ( purchaseorderUpForm . getPayment item List( ) , PaymentitemEntity . class ) ;
for ( PaymentitemEntity entitys : PaymentitemList ) {
entitys . setId ( RandomUtil . uuId ( ) ) ;
entitys . setPaymentno ( entitys . getPaymentno ( ) ) ;
paymentitemService . save ( entitys ) ;
}
} * /
// QueryWrapper<PaymentitemEntity> PaymentitemqueryWrapper = new QueryWrapper<>();
// PaymentitemqueryWrapper.lambda().eq(PaymentitemEntity::getDocumentno, entity.getDocumentNo());
// paymentitemService.remove(PaymentitemqueryWrapper);
@ -675,11 +743,11 @@ public class PurchaseorderController {
// entitys.setDocumentno(entity.getDocumentNo());
// paymentitemService.save(entitys);
// }
QueryWrapper < PurchasebackitemEntity > PurchasebackitemqueryWrapper = new QueryWrapper < > ( ) ;
/ * QueryWrapper < PurchasebackitemEntity > PurchasebackitemqueryWrapper = new QueryWrapper < > ( ) ;
PurchasebackitemqueryWrapper . lambda ( ) . eq ( PurchasebackitemEntity : : getPurchaseOrderId , entity . getId ( ) ) ;
purchasebackitemService . remove ( PurchasebackitemqueryWrapper ) ;
List < PurchasebackitemEntity > PurchasebackitemList = JsonUtil . getJsonToList ( purchaseorderUpForm . getPurchaseback List( ) , PurchasebackitemEntity . class ) ;
List < PurchasebackitemEntity > PurchasebackitemList = JsonUtil . getJsonToList ( purchaseorderUpForm . getPurchaseback item List( ) , PurchasebackitemEntity . class ) ;
for ( PurchasebackitemEntity entitys : PurchasebackitemList ) {
entitys . setId ( RandomUtil . uuId ( ) ) ;
entitys . setPurchaseOrderId ( entity . getId ( ) ) ;
@ -694,7 +762,7 @@ public class PurchaseorderController {
entitys . setId ( RandomUtil . uuId ( ) ) ;
entitys . setSalesOrderNo ( entity . getDocumentNo ( ) ) ;
collectionpoService . save ( entitys ) ;
}
} * /
return ActionResult . success ( "更新成功" ) ;
} else {