采购订单转销售查询

product
17602169347 2 years ago
parent f129e031ef
commit a793904a4c

@ -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) {

@ -38,4 +38,6 @@ public interface PoundlistMapper extends BaseMapper<PoundlistEntity> {
List<PoundlistEntity> queryPoundListByIdsRenkuan(@Param("poundlistIdList") List<String> poundlistIdList, @Param("paymentdocId") String paymentdocId);
List<PoundlistEntity> queryByKeywordNotPage(@Param("poundlistPagination") PoundlistPagination poundlistPagination, @Param("ew") Wrapper<PoundlistEntity> queryWrapper);
List<PoundlistEntity> queryCreateSale(@Param("idList") List<String> idList);
}

@ -45,7 +45,7 @@ public class PoundlistPagination extends Pagination {
private String purchaseStatus;
private String salesStatus;
private String ids;
/**
*
*/

@ -61,4 +61,6 @@ public interface PoundlistService extends IService<PoundlistEntity> {
Map<String, Object> importPreview(List<PoundlistEntity> personList);
PoundlistImportVo importData(List<PoundlistDTO> dataList) throws ParseException, DataException;
List<PoundlistEntity> queryCreateSale(List<String> idList);
}

@ -474,6 +474,11 @@ public class PoundlistServiceImpl extends ServiceImpl<PoundlistMapper, Poundlist
return importVo;
}
@Override
public List<PoundlistEntity> queryCreateSale(List<String> idList) {
return poundlistMapper.queryCreateSale(idList);
}
@Override
public void delete(PoundlistEntity entity) {

@ -287,4 +287,18 @@ WHERE a.delete_mark = 0 and
ORDER BY ${poundlistPagination.sidx} ${poundlistPagination.sort}
</if>
</select>
<select id="queryCreateSale" resultType="jnpf.poundlist.entity.PoundlistEntity">
SELECT a.*,f.contract_name contractName,f.contract_no contractNo,d.supplier_nm customerName,b.ticketno vehicleName,e.item_name materialName
from jg_poundlist a
LEFT JOIN jg_contract f on a.sales_id = f.id and f.delete_mark = 0
LEFT JOIN jg_customer d on a.customer_id = d.id and d.delete_mark = 0
LEFT JOIN jg_vehicle b on a.vehicle_id = b.id and b.delete_mark = 0
LEFT JOIN jg_material e on a.material_id = e.id and e.delete_mark = 0
where a.delete_mark = 0 and a.is_examine = '1' and a.sales_status = '99' and a.id in
<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>

Loading…
Cancel
Save