|
|
|
@ -11,6 +11,7 @@ import com.glxp.api.admin.constant.Constant;
|
|
|
|
|
import com.glxp.api.admin.constant.ConstantStatus;
|
|
|
|
|
import com.glxp.api.admin.constant.ConstantType;
|
|
|
|
|
import com.glxp.api.admin.dao.basic.BussinessTypeDao;
|
|
|
|
|
import com.glxp.api.admin.dao.basic.CompanyProductRelevanceDao;
|
|
|
|
|
import com.glxp.api.admin.dao.basic.UnitMaintainDao;
|
|
|
|
|
import com.glxp.api.admin.dao.inout.CodesDao;
|
|
|
|
|
import com.glxp.api.admin.dao.inout.CodesTempDao;
|
|
|
|
@ -73,6 +74,8 @@ public class InvCountOrderServiceImpl implements InvCountOrderService {
|
|
|
|
|
private InvCountCodesService invCountCodesService;
|
|
|
|
|
@Resource
|
|
|
|
|
private CodesDao codesDao;
|
|
|
|
|
@Resource
|
|
|
|
|
private CompanyProductRelevanceDao companyProductRelevanceDao;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<InvCountOrderResponse> filterList(FilterInvCountOrderRequest filterInvCountOrderRequest) {
|
|
|
|
@ -299,7 +302,7 @@ public class InvCountOrderServiceImpl implements InvCountOrderService {
|
|
|
|
|
warehouseEntity.setReCount(codeNum);
|
|
|
|
|
|
|
|
|
|
//设置供应商信息
|
|
|
|
|
setSupInfo(warehouseEntity);
|
|
|
|
|
setSupInfo(warehouseEntity, "loss");
|
|
|
|
|
outOrderCodes.add(warehouseEntity);
|
|
|
|
|
} else {
|
|
|
|
|
for (InvProductDetailEntity invProductDetailEntity : invProductDetailEntities) {
|
|
|
|
@ -323,7 +326,7 @@ public class InvCountOrderServiceImpl implements InvCountOrderService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//设置供应商信息
|
|
|
|
|
setSupInfo(warehouseEntity);
|
|
|
|
|
setSupInfo(warehouseEntity, "loss");
|
|
|
|
|
outOrderCodes.add(warehouseEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -362,11 +365,11 @@ public class InvCountOrderServiceImpl implements InvCountOrderService {
|
|
|
|
|
UdiEntity udi = FilterUdiUtils.getUdi(countCodesList.get(0));
|
|
|
|
|
//修改码数量
|
|
|
|
|
int actCount = invCountCodesService.getActCount(udi.getUdi());
|
|
|
|
|
//使用此盘点单据详情的盘亏数量 / 实际数量,计算得出扫码数量
|
|
|
|
|
//使用此盘点单据详情的盘盈数量 / 实际数量,计算得出扫码数量
|
|
|
|
|
int codeNum = invCountOrderDetail.getProfitNum() / actCount;
|
|
|
|
|
warehouseEntity.setCount(codeNum);
|
|
|
|
|
warehouseEntity.setReCount(codeNum);
|
|
|
|
|
setSupInfo(warehouseEntity);
|
|
|
|
|
setSupInfo(warehouseEntity, "profit");
|
|
|
|
|
inOrderCodes.add(warehouseEntity);
|
|
|
|
|
} else {
|
|
|
|
|
for (String code : profitCodes) {
|
|
|
|
@ -378,7 +381,7 @@ public class InvCountOrderServiceImpl implements InvCountOrderService {
|
|
|
|
|
if ((StrUtil.isBlank(udi.getBatchNo()) && StrUtil.isBlank(udi.getSerialNo())) || (StrUtil.isBlank(udi.getSerialNo()) && StrUtil.isNotBlank(udi.getBatchNo()))) {
|
|
|
|
|
//修改码数量
|
|
|
|
|
int actCount = invCountCodesService.getActCount(udi.getUdi());
|
|
|
|
|
//使用此盘点单据详情的盘亏数量 / 实际数量,计算得出扫码数量
|
|
|
|
|
//使用此盘点单据详情的盘盈数量 / 实际数量,计算得出扫码数量
|
|
|
|
|
int codeNum = invCountOrderDetail.getProfitNum() / actCount;
|
|
|
|
|
warehouseEntity.setCount(codeNum);
|
|
|
|
|
warehouseEntity.setReCount(codeNum);
|
|
|
|
@ -388,7 +391,7 @@ public class InvCountOrderServiceImpl implements InvCountOrderService {
|
|
|
|
|
warehouseEntity.setCount(actCount);
|
|
|
|
|
warehouseEntity.setReCount(actCount);
|
|
|
|
|
}
|
|
|
|
|
setSupInfo(warehouseEntity);
|
|
|
|
|
setSupInfo(warehouseEntity, "profit");
|
|
|
|
|
inOrderCodes.add(warehouseEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -444,18 +447,43 @@ public class InvCountOrderServiceImpl implements InvCountOrderService {
|
|
|
|
|
/**
|
|
|
|
|
* 对条码添加供应商信息
|
|
|
|
|
*
|
|
|
|
|
* @param warehouseEntity
|
|
|
|
|
* @param warehouseEntity 码明细
|
|
|
|
|
* @param countStatus 盈亏状态
|
|
|
|
|
*/
|
|
|
|
|
private void setSupInfo(WarehouseEntity warehouseEntity) {
|
|
|
|
|
//设置供应商参数
|
|
|
|
|
String supId = invProductDetailDao.selectSupIdByCode(warehouseEntity.getCode());
|
|
|
|
|
if (StrUtil.isNotEmpty(supId)) {
|
|
|
|
|
warehouseEntity.setSupId(supId);
|
|
|
|
|
private void setSupInfo(WarehouseEntity warehouseEntity, String countStatus) {
|
|
|
|
|
/**
|
|
|
|
|
* 根据此码明细的盈亏状态,使用不同的逻辑生成供应商信息
|
|
|
|
|
* 盘盈:此条码不存在于库存详情中,需要从供应商产品信息表查询供应商信息
|
|
|
|
|
* 盘亏:此条码在库存中存在,但是盘点中没有此条码,直接查询库存详情表中的供应商ID
|
|
|
|
|
*
|
|
|
|
|
* 若查询出的供应商信息多余1条,则表明此产品被多个供应商绑定,在此处不进行绑定,单据生成之后会进入异常单据页面,在异常单据页面手动指定供应商
|
|
|
|
|
*/
|
|
|
|
|
if (countStatus.equals("loss")) {
|
|
|
|
|
log.info("生成盘亏单据条码供应商详情,条码信息:{}", warehouseEntity.getCode());
|
|
|
|
|
List<String> supIds = invProductDetailDao.selectSupIdByCode(warehouseEntity.getCode());
|
|
|
|
|
if (CollUtil.isNotEmpty(supIds)) {
|
|
|
|
|
if (supIds.size() == 1) {
|
|
|
|
|
//此产品只绑定了一个供应商,若绑定了多个供应商,则不填供应商ID字段,生成单据之后会进入异常单据页面,手动指定供应商
|
|
|
|
|
warehouseEntity.setSupId(supIds.get(0));
|
|
|
|
|
//查询供应商名称
|
|
|
|
|
String name = unitMaintainDao.selectNameByErpId(supId);
|
|
|
|
|
String name = unitMaintainDao.selectNameByErpId(supIds.get(0));
|
|
|
|
|
warehouseEntity.setSupName(name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
log.info("生成盘盈单据条码供应商详情,条码信息:{}", warehouseEntity.getCode());
|
|
|
|
|
List<String> unitFkList = companyProductRelevanceDao.selectUnitFkByUdiRlIdFk(warehouseEntity.getRelId());
|
|
|
|
|
if (CollUtil.isNotEmpty(unitFkList)) {
|
|
|
|
|
if (unitFkList.size() == 1) {
|
|
|
|
|
//此产品只绑定了一个供应商,若绑定了多个供应商,则不填供应商ID字段,生成单据之后会进入异常单据页面,手动指定供应商
|
|
|
|
|
warehouseEntity.setSupId(unitFkList.get(0));
|
|
|
|
|
//查询供应商名称
|
|
|
|
|
String name = unitMaintainDao.selectNameByErpId(unitFkList.get(0));
|
|
|
|
|
warehouseEntity.setSupName(name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 校验码重复
|
|
|
|
|