修改请购接口
This commit is contained in:
parent
75bc053a97
commit
250d46cd02
|
|
@ -316,4 +316,12 @@ public class InvoicingApi {
|
||||||
return Result.OK("添加成功!");
|
return Result.OK("添加成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value="拣货物料", notes="拣货物料")
|
||||||
|
@AutoLog(value = "拣货物料")
|
||||||
|
@PostMapping(value = "/pickingInfo")
|
||||||
|
public Result<String> pickingInfo(@RequestBody CgdInfoEntity cgdInfoEntityDto) {
|
||||||
|
String result = invoicingApi.pickingInfo(cgdInfoEntityDto);
|
||||||
|
return Result.OK("拣货成功!");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,11 @@ public class CgdInfoEntity implements Serializable {
|
||||||
private String kcsl;
|
private String kcsl;
|
||||||
private String dhbl;
|
private String dhbl;
|
||||||
|
|
||||||
|
private String jhPic;
|
||||||
|
private Integer jhNum;
|
||||||
|
private String jhId;
|
||||||
|
private String jhType;//0拣货 1销账
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 格式化getter方法
|
// 格式化getter方法
|
||||||
|
|
|
||||||
|
|
@ -70,4 +70,6 @@ public interface IInvoicingApi {
|
||||||
IPage<CgdSxdEntity> querySxdList(Integer pageNo, Integer pageSize, CgdSxdEntity cgdSxdEntityDto, HttpServletRequest req);
|
IPage<CgdSxdEntity> querySxdList(Integer pageNo, Integer pageSize, CgdSxdEntity cgdSxdEntityDto, HttpServletRequest req);
|
||||||
|
|
||||||
String addWaringAll(CgdInfoEntity cgdInfoEntityDto);
|
String addWaringAll(CgdInfoEntity cgdInfoEntityDto);
|
||||||
|
|
||||||
|
String pickingInfo(CgdInfoEntity cgdInfoEntityDto);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,11 @@
|
||||||
<select id="getGwcMaterialTreeData" resultType="com.nu.modules.ConfigMaterial.entity.ConfigMaterialCategory">
|
<select id="getGwcMaterialTreeData" resultType="com.nu.modules.ConfigMaterial.entity.ConfigMaterialCategory">
|
||||||
select b.category_id,b.type_id,b.medication_id from nu_invoicing_qgd_info a
|
select b.category_id,b.type_id,b.medication_id from nu_invoicing_qgd_info a
|
||||||
left join nu_config_material_info b on a.wl_id = b.id
|
left join nu_config_material_info b on a.wl_id = b.id
|
||||||
|
<where>
|
||||||
|
<if test="params.nuId != null and params.nuId != ''">
|
||||||
|
and a.nu_id = #{params.nuId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
GROUP BY b.category_id,b.type_id,b.medication_id
|
GROUP BY b.category_id,b.type_id,b.medication_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.nu.modules.cgd.entity;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
|
@ -151,14 +152,14 @@ public class NuInvoicingCgdInfo implements Serializable {
|
||||||
private BigDecimal totalPrice;
|
private BigDecimal totalPrice;
|
||||||
|
|
||||||
|
|
||||||
// 格式化getter方法
|
// // 格式化getter方法
|
||||||
public String getProcurementPrice() {
|
// public BigDecimal getProcurementPrice() {
|
||||||
return procurementPrice != null ?
|
// BigDecimal result = procurementPrice != null ? procurementPrice.setScale(2, RoundingMode.DOWN) : null;
|
||||||
procurementPrice.setScale(2, BigDecimal.ROUND_HALF_UP).toString() : null;
|
// return result;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getArrivalPrice() {
|
// public BigDecimal getArrivalPrice() {
|
||||||
return arrivalPrice != null ?
|
// BigDecimal result = arrivalPrice != null ? arrivalPrice.setScale(2, RoundingMode.DOWN) : null;
|
||||||
arrivalPrice.setScale(2, BigDecimal.ROUND_HALF_UP).toString() : null;
|
// return result;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -592,6 +592,7 @@ public class NuInvoicingCgdMainServiceImpl extends ServiceImpl<NuInvoicingCgdMai
|
||||||
queryWrapper.eq(StringUtils.isNotEmpty(configMaterialCategory.getTypeId()),"b.type_id",configMaterialCategory.getTypeId());
|
queryWrapper.eq(StringUtils.isNotEmpty(configMaterialCategory.getTypeId()),"b.type_id",configMaterialCategory.getTypeId());
|
||||||
queryWrapper.eq(StringUtils.isNotEmpty(configMaterialCategory.getMedicationId()),"b.medication_id",configMaterialCategory.getMedicationId());
|
queryWrapper.eq(StringUtils.isNotEmpty(configMaterialCategory.getMedicationId()),"b.medication_id",configMaterialCategory.getMedicationId());
|
||||||
queryWrapper.in(StringUtils.isNotBlank(configMaterialCategory.getSuppliers()),"b.suppliers",configMaterialCategory.getSuppliers());
|
queryWrapper.in(StringUtils.isNotBlank(configMaterialCategory.getSuppliers()),"b.suppliers",configMaterialCategory.getSuppliers());
|
||||||
|
queryWrapper.in(StringUtils.isNotBlank(configMaterialCategory.getNuId()),"a.nu_id",configMaterialCategory.getNuId());
|
||||||
List<ConfigMaterialInfo> list = configMaterialInfoMapper.getGwcTreeDataWlnum(queryWrapper);
|
List<ConfigMaterialInfo> list = configMaterialInfoMapper.getGwcTreeDataWlnum(queryWrapper);
|
||||||
map.put("success",true);
|
map.put("success",true);
|
||||||
map.put("message","物料数量");
|
map.put("message","物料数量");
|
||||||
|
|
@ -630,10 +631,10 @@ public class NuInvoicingCgdMainServiceImpl extends ServiceImpl<NuInvoicingCgdMai
|
||||||
|
|
||||||
//获取物料基础信息
|
//获取物料基础信息
|
||||||
ConfigMaterialInfo ConfigMaterialInfo = configMaterialInfoMapper.selectById(info.getWlId());
|
ConfigMaterialInfo ConfigMaterialInfo = configMaterialInfoMapper.selectById(info.getWlId());
|
||||||
if(qgdInfoRes!=null){
|
// if(qgdInfoRes!=null){
|
||||||
return "1";
|
// return "1";
|
||||||
}
|
// }
|
||||||
List<QgdInfo> listqg = qgdInfoMapper.selectList(new QueryWrapper<QgdInfo>().eq("wl_id",info.getWlId()).eq("nu_id",info.getNuId()));
|
List<QgdInfo> listqg = qgdInfoMapper.selectList(new QueryWrapper<QgdInfo>().eq("wl_id",info.getWlId()).eq("nu_id",info.getNuId()).ne("id",qgdInfo.getId()));
|
||||||
int totalQgsl = 0;
|
int totalQgsl = 0;
|
||||||
if(StringUtils.isNotBlank(info.getKcsl())){
|
if(StringUtils.isNotBlank(info.getKcsl())){
|
||||||
totalQgsl = Integer.parseInt(info.getKcsl());
|
totalQgsl = Integer.parseInt(info.getKcsl());
|
||||||
|
|
@ -816,4 +817,90 @@ public class NuInvoicingCgdMainServiceImpl extends ServiceImpl<NuInvoicingCgdMai
|
||||||
return "1";
|
return "1";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String pickingInfo(CgdInfoEntity cgdInfoEntityDto) {
|
||||||
|
QueryWrapper<NuInvoicingCgdInfo> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("id",cgdInfoEntityDto.getJhId());
|
||||||
|
//请购信息
|
||||||
|
NuInvoicingCgdInfo cgdInfo = cgdInfoMapper.selectOne(queryWrapper);
|
||||||
|
//采购单信息
|
||||||
|
NuInvoicingCgdMain cgdMain = cgdMainMapper.selectOne(new QueryWrapper<NuInvoicingCgdMain>().eq("id",cgdInfo.getCgdId()));
|
||||||
|
//库存信息
|
||||||
|
BlWarehouseMaterialInfo mterialInfo = mterialInfoMapper.selectOne(new QueryWrapper<BlWarehouseMaterialInfo>().eq("wl_id",cgdInfo.getWlId()).eq("nu_id",cgdInfo.getNuId()));
|
||||||
|
Integer cgsl = cgdInfo.getPurchaseQuantity();//请购数量
|
||||||
|
Integer rksl = cgdInfo.getRksl();//入库数量
|
||||||
|
Integer wrksl = 0;//未入库数量
|
||||||
|
Integer xzsl = cgdInfo.getXzsl();//销账数量
|
||||||
|
Integer jhNum = cgdInfoEntityDto.getJhNum();//本次入库数量
|
||||||
|
String jhType = cgdInfoEntityDto.getJhType();//入库类型 0入库 1销账
|
||||||
|
String jhPic = cgdInfoEntityDto.getJhPic();//拣货图片
|
||||||
|
BigDecimal procurementPrice = cgdInfo.getProcurementPrice();//原来采购单价
|
||||||
|
BigDecimal arrivalPrice = cgdInfo.getArrivalPrice();//改价后的价格
|
||||||
|
BigDecimal price = new BigDecimal("0");//实际采购单价
|
||||||
|
String kcsl = mterialInfo.getKcsl();//库存数量
|
||||||
|
//判断arrivalPrice是否为空
|
||||||
|
if(arrivalPrice != null){
|
||||||
|
price = arrivalPrice;
|
||||||
|
}else {
|
||||||
|
price = procurementPrice;
|
||||||
|
}
|
||||||
|
//-------------------------记录出入库记录--------------------------
|
||||||
|
NuWarehouseMaterialCrkInfo crkInfo = new NuWarehouseMaterialCrkInfo();
|
||||||
|
crkInfo.setCgdId(cgdInfo.getCgdId());
|
||||||
|
crkInfo.setNuId(cgdInfo.getNuId());
|
||||||
|
crkInfo.setWlId(cgdInfo.getWlId());
|
||||||
|
crkInfo.setCrkNum(jhNum);//出入库数量
|
||||||
|
crkInfo.setCrkType("1");//请购单类型 此处是固定的
|
||||||
|
crkInfo.setJhPic(jhPic);//拣货图片
|
||||||
|
crkInfo.setOldPrice(procurementPrice);//原来的价格(最开始的采购价格)
|
||||||
|
crkInfo.setNewPrice(price);//新的价格
|
||||||
|
crkInfo.setCzqkcl(kcsl);//操作前库存量
|
||||||
|
String dqkcl = kcsl;
|
||||||
|
if(StringUtils.equals("0",jhType)){//入库操作
|
||||||
|
crkInfo.setCrkStatus("1");
|
||||||
|
dqkcl = (Integer.parseInt(kcsl) + jhNum) + "";
|
||||||
|
rksl = rksl + jhNum;
|
||||||
|
}else if(StringUtils.equals("1",jhType)){//销账操作
|
||||||
|
crkInfo.setCrkStatus("2");
|
||||||
|
xzsl = xzsl + jhNum;
|
||||||
|
}
|
||||||
|
crkInfo.setDqkcl(dqkcl);//当前库存量(操作后的库存量)
|
||||||
|
crkInfoMapper.insert(crkInfo);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//更新库存量
|
||||||
|
if(StringUtils.equals("0",jhType)){//入库操作
|
||||||
|
mterialInfo.setKcsl(dqkcl);
|
||||||
|
mterialInfoMapper.updateById(mterialInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
//更新采购单物料信息
|
||||||
|
//未入库数量 = 采购数量 - 入库数量 - 销账数量
|
||||||
|
wrksl = cgsl - rksl - xzsl;
|
||||||
|
cgdInfo.setWrksl(wrksl);
|
||||||
|
cgdInfo.setRksl(rksl);
|
||||||
|
cgdInfo.setXzsl(xzsl);
|
||||||
|
cgdInfoMapper.updateById(cgdInfo);
|
||||||
|
|
||||||
|
//更新主表拣货人信息
|
||||||
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
|
//判断拣货人信息是否为空,不为空就给值
|
||||||
|
if(StringUtils.isEmpty(cgdMain.getJhBy())){
|
||||||
|
cgdMain.setJhBy(loginUser.getRealname());
|
||||||
|
cgdMain.setJhTime(new Date());
|
||||||
|
cgdMain.setStatus("1");
|
||||||
|
cgdMainMapper.updateById(cgdMain);
|
||||||
|
}
|
||||||
|
//判断单据是否完结 如果采购数量 = 入库数量 + 销账数量 就代表这个单据完结了
|
||||||
|
if(cgsl == rksl + xzsl){
|
||||||
|
cgdMain.setWjBy(loginUser.getRealname());
|
||||||
|
cgdMain.setWjTime(new Date());
|
||||||
|
cgdMain.setStatus("2");
|
||||||
|
cgdMainMapper.updateById(cgdMain);
|
||||||
|
}
|
||||||
|
|
||||||
|
return "1";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue