优化库存逻辑和单据sku
This commit is contained in:
@@ -270,13 +270,12 @@ public class DepotHeadController {
|
||||
String beanJson = body.getInfo();
|
||||
String rows = body.getRows();
|
||||
Long billsNumLimit = Long.parseLong(redisService.getObjectFromSessionByKey(request,"billsNumLimit").toString());
|
||||
Long tenantId = redisService.getTenantId(request);
|
||||
Long count = depotHeadService.countDepotHead(null,null,null,null,null,null,null,null,null,null,null);
|
||||
if(count>= billsNumLimit) {
|
||||
throw new BusinessParamCheckingException(ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_CODE,
|
||||
ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_MSG);
|
||||
} else {
|
||||
depotHeadService.addDepotHeadAndDetail(beanJson,rows,tenantId, request);
|
||||
depotHeadService.addDepotHeadAndDetail(beanJson,rows, request);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -290,11 +289,10 @@ public class DepotHeadController {
|
||||
*/
|
||||
@PutMapping(value = "/updateDepotHeadAndDetail")
|
||||
public Object updateDepotHeadAndDetail(@RequestBody DepotHeadVo4Body body, HttpServletRequest request) throws Exception{
|
||||
Long tenantId = redisService.getTenantId(request);
|
||||
JSONObject result = ExceptionConstants.standardSuccess();
|
||||
String beanJson = body.getInfo();
|
||||
String rows = body.getRows();
|
||||
depotHeadService.updateDepotHeadAndDetail(beanJson,rows,tenantId,request);
|
||||
depotHeadService.updateDepotHeadAndDetail(beanJson,rows,request);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -118,11 +118,10 @@ public class DepotItemController {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
try {
|
||||
BigDecimal stock = BigDecimal.ZERO;
|
||||
Long tenantId = redisService.getTenantId(request);
|
||||
List<MaterialVo4Unit> list = materialService.getMaterialByBarCode(barCode);
|
||||
if(list!=null && list.size()>0) {
|
||||
MaterialVo4Unit materialVo4Unit = list.get(0);
|
||||
stock = depotItemService.getStockByParam(depotId,materialVo4Unit.getId(),null,null,tenantId);
|
||||
stock = depotItemService.getStockByParam(depotId,materialVo4Unit.getId(),null,null);
|
||||
String commodityUnit = materialVo4Unit.getCommodityUnit();
|
||||
Long unitId = materialVo4Unit.getUnitId();
|
||||
if(unitId!=null) {
|
||||
@@ -152,7 +151,6 @@ public class DepotItemController {
|
||||
@RequestParam("mpList") String mpList,
|
||||
HttpServletRequest request)throws Exception {
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
Long tenantId = redisService.getTenantId(request);
|
||||
try {
|
||||
List<DepotItemVo4WithInfoEx> dataList = new ArrayList<DepotItemVo4WithInfoEx>();
|
||||
if(headerId != 0) {
|
||||
@@ -173,7 +171,7 @@ public class DepotItemController {
|
||||
item.put("model", diEx.getMModel());
|
||||
item.put("materialOther", getOtherInfo(mpArr, diEx));
|
||||
Integer ratio = diEx.getRatio();
|
||||
BigDecimal stock = depotItemService.getStockByParam(diEx.getDepotId(),diEx.getMaterialId(),null,null,tenantId);
|
||||
BigDecimal stock = depotItemService.getStockByParam(diEx.getDepotId(),diEx.getMaterialId(),null,null);
|
||||
if(ratio!=null){
|
||||
BigDecimal ratioDecimal = new BigDecimal(ratio.toString());
|
||||
if(ratioDecimal.compareTo(BigDecimal.ZERO)!=0){
|
||||
@@ -262,7 +260,6 @@ public class DepotItemController {
|
||||
HttpServletRequest request)throws Exception {
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
Long tenantId = redisService.getTenantId(request);
|
||||
String timeA = Tools.firstDayOfMonth(monthTime) + BusinessConstants.DAY_FIRST_TIME;
|
||||
String timeB = Tools.lastDayOfMonth(monthTime) + BusinessConstants.DAY_LAST_TIME;
|
||||
try {
|
||||
@@ -292,10 +289,10 @@ public class DepotItemController {
|
||||
item.put("materialColor", diEx.getMColor());
|
||||
item.put("unitName", getUName(diEx.getMaterialUnit(), diEx.getUnitName()));
|
||||
|
||||
item.put("prevSum", depotItemService.getStockByParam(depotId,mId,null,timeA,tenantId));
|
||||
item.put("inSum", depotItemService.getInNumByParam(depotId,mId,timeA,timeB,tenantId));
|
||||
item.put("outSum", depotItemService.getOutNumByParam(depotId,mId,timeA,timeB,tenantId));
|
||||
BigDecimal thisSum = depotItemService.getStockByParam(depotId,mId,null,timeB,tenantId);
|
||||
item.put("prevSum", depotItemService.getStockByParam(depotId,mId,null,timeA));
|
||||
item.put("inSum", depotItemService.getInNumByParam(depotId,mId,timeA,timeB));
|
||||
item.put("outSum", depotItemService.getOutNumByParam(depotId,mId,timeA,timeB));
|
||||
BigDecimal thisSum = depotItemService.getStockByParam(depotId,mId,null,timeB);
|
||||
item.put("thisSum", thisSum);
|
||||
for(MaterialExtend me:meList) {
|
||||
if(me.getMaterialId().longValue() == diEx.getMId().longValue()) {
|
||||
@@ -333,7 +330,6 @@ public class DepotItemController {
|
||||
@RequestParam("monthTime") String monthTime,
|
||||
@RequestParam("materialParam") String materialParam,
|
||||
HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
Long tenantId = redisService.getTenantId(request);
|
||||
String timeA = Tools.firstDayOfMonth(monthTime) + BusinessConstants.DAY_FIRST_TIME;
|
||||
String timeB = Tools.lastDayOfMonth(monthTime) + BusinessConstants.DAY_LAST_TIME;
|
||||
try {
|
||||
@@ -353,10 +349,10 @@ public class DepotItemController {
|
||||
objs[3] = diEx.getMModel();
|
||||
objs[4] = diEx.getMaterialUnit();
|
||||
objs[5] = diEx.getPurchaseDecimal().toString();
|
||||
objs[6] = depotItemService.getStockByParam(depotId,mId,null,timeA,tenantId).toString();
|
||||
objs[7] = depotItemService.getInNumByParam(depotId,mId,timeA,timeB,tenantId).toString();
|
||||
objs[8] = depotItemService.getOutNumByParam(depotId,mId,timeA,timeB,tenantId).toString();
|
||||
BigDecimal thisSum = depotItemService.getStockByParam(depotId,mId,null,timeB,tenantId);
|
||||
objs[6] = depotItemService.getStockByParam(depotId,mId,null,timeA).toString();
|
||||
objs[7] = depotItemService.getInNumByParam(depotId,mId,timeA,timeB).toString();
|
||||
objs[8] = depotItemService.getOutNumByParam(depotId,mId,timeA,timeB).toString();
|
||||
BigDecimal thisSum = depotItemService.getStockByParam(depotId,mId,null,timeB);
|
||||
objs[9] = thisSum.toString();
|
||||
objs[10] = thisSum.multiply(diEx.getPurchaseDecimal()).toString();
|
||||
objects.add(objs);
|
||||
@@ -384,7 +380,6 @@ public class DepotItemController {
|
||||
HttpServletRequest request) throws Exception{
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
Long tenantId = redisService.getTenantId(request);
|
||||
String endTime = Tools.lastDayOfMonth(monthTime) + BusinessConstants.DAY_LAST_TIME;
|
||||
try {
|
||||
List<DepotItemVo4WithInfoEx> dataList = depotItemService.findByAll(StringUtil.toNull(materialParam),
|
||||
@@ -393,7 +388,7 @@ public class DepotItemController {
|
||||
if (null != dataList) {
|
||||
for (DepotItemVo4WithInfoEx diEx : dataList) {
|
||||
Long mId = diEx.getMId();
|
||||
BigDecimal thisSum = depotItemService.getStockByParam(depotId,mId,null,endTime,tenantId);
|
||||
BigDecimal thisSum = depotItemService.getStockByParam(depotId,mId,null,endTime);
|
||||
BigDecimal unitPrice = diEx.getPurchaseDecimal();
|
||||
if(unitPrice == null) {
|
||||
unitPrice = BigDecimal.ZERO;
|
||||
|
||||
@@ -169,7 +169,6 @@ public class MaterialController {
|
||||
HttpServletRequest request) throws Exception{
|
||||
JSONObject object = new JSONObject();
|
||||
try {
|
||||
Long tenantId = redisService.getTenantId(request);
|
||||
List<MaterialVo4Unit> dataList = materialService.findBySelectWithBarCode(categoryId, q, (currentPage-1)*pageSize, pageSize);
|
||||
String[] mpArr = mpList.split(",");
|
||||
int total = materialService.findBySelectWithBarCodeCount(categoryId, q);
|
||||
@@ -196,7 +195,11 @@ public class MaterialController {
|
||||
item.put("model", material.getModel());
|
||||
item.put("unit", material.getCommodityUnit() + ratio);
|
||||
item.put("sku", material.getSku());
|
||||
BigDecimal stock = depotItemService.getStockByParam(depotId,material.getId(),null,null,tenantId);
|
||||
BigDecimal skuStock = depotItemService.getSkuStockByParam(depotId,material.getMeId(),null,null);
|
||||
if(StringUtil.isNotEmpty(material.getSku())){
|
||||
item.put("skuStock", skuStock);
|
||||
}
|
||||
BigDecimal stock = depotItemService.getStockByParam(depotId,material.getId(),null,null);
|
||||
if (material.getUnitId()!=null){
|
||||
Unit unit = unitService.getUnit(material.getUnitId());
|
||||
if(material.getCommodityUnit().equals(unit.getOtherUnit())) {
|
||||
|
||||
Reference in New Issue
Block a user