|
|
|
@ -111,9 +111,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
Long producedDate = Long.valueOf(0); |
|
|
|
if (map.containsKey("producedDate")) { |
|
|
|
Object s = map.get("producedDate"); |
|
|
|
if(s == null || "".equals(s.toString())){ |
|
|
|
if (s == null || "".equals(s.toString())) { |
|
|
|
producedDate = Long.valueOf(0); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
producedDate = DateUtil.DateTimeByDayToTimeStamp(s.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -125,7 +125,13 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 获取当前入库金额
|
|
|
|
Double amounts = (quantity * price * 100); |
|
|
|
// 获取平均价格
|
|
|
|
Double avgPrice = (material.getAmounts() + amounts) / (material.getQuantity() + quantity); |
|
|
|
double avgPrice = 0.0; |
|
|
|
if(quantity != 0){ |
|
|
|
avgPrice = (amounts) / ( quantity); |
|
|
|
}else{ |
|
|
|
avgPrice = price * 100; |
|
|
|
} |
|
|
|
|
|
|
|
map.put("amounts", amounts); |
|
|
|
map.put("price", price * 100); |
|
|
|
String simpleTime = DateUtil.getSimpleTime(new Date()); |
|
|
|
@ -154,12 +160,18 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
insert.put("amounts", amounts); |
|
|
|
insert.put("shelfLife", materialById.getShelfLife()); |
|
|
|
insert.put("producedDate", producedDate); |
|
|
|
insert.put("mid",map.get("mid")); |
|
|
|
insert.put("mid", map.get("mid")); |
|
|
|
materialMapper.insertInventory(insert); |
|
|
|
newMid = ObjectFormatUtil.toInteger(insert.get("id")); |
|
|
|
} |
|
|
|
// 将新入库的物料id记录下来
|
|
|
|
map.put("newInMid", newMid); |
|
|
|
|
|
|
|
// 如果包含realQuantity则代表是入库的拆单单位
|
|
|
|
if(map.containsKey("realQuantity")){ |
|
|
|
// 将入库数量修改为realQuantity
|
|
|
|
map.put("quantity",map.get("realQuantity")); |
|
|
|
} |
|
|
|
return depositoryRecordMapper.insertApplicationInRecord(map); |
|
|
|
} |
|
|
|
|
|
|
|
@ -189,7 +201,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
map.put("state", "待部门负责人审核"); |
|
|
|
if (mid != null) { |
|
|
|
// 获取当前物料
|
|
|
|
Inventory materialById = materialMapper.findInventoryByMid(mid); |
|
|
|
Inventory materialById = materialMapper.findInventoryById(mid); |
|
|
|
int amounts = (int) ((materialById.getPrice() / 100) * quantity * 100); |
|
|
|
map.put("price", amounts); |
|
|
|
Map<String, Object> update = new HashMap<>(); |
|
|
|
@ -203,7 +215,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
Depository depositoryRecordById = depositoryMapper.findDepositoryById(materialById.getDepositoryId()); |
|
|
|
dname = depositoryRecordById.getDname(); |
|
|
|
} |
|
|
|
|
|
|
|
Administration company = LinkInterfaceUtil.getCompany(userToken.getMaindeparment(), userToken); |
|
|
|
String code = createCode(dname, "outOrderNumber", "out", company.getName()); |
|
|
|
map.put("code", code); |
|
|
|
@ -227,7 +238,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Map<String,Object> CalculateAllApplicationInCount() { |
|
|
|
public Map<String, Object> CalculateAllApplicationInCount() { |
|
|
|
|
|
|
|
// 获取当前时间
|
|
|
|
long now = System.currentTimeMillis(); |
|
|
|
@ -238,13 +249,13 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
Long yesterdayTimeForCalc = DateUtil.getYesterdayTimeForCalc(); |
|
|
|
|
|
|
|
// 用于查询今天到现在的入库记录
|
|
|
|
Map<String,Object> mapForToday = new HashMap<>(); |
|
|
|
mapForToday.put("start",nowTimeForCalc); |
|
|
|
mapForToday.put("end",now); |
|
|
|
Map<String, Object> mapForToday = new HashMap<>(); |
|
|
|
mapForToday.put("start", nowTimeForCalc); |
|
|
|
mapForToday.put("end", now); |
|
|
|
// 用于查询昨天的入库记录
|
|
|
|
Map<String,Object> mapForYesterday = new HashMap<>(); |
|
|
|
mapForYesterday.put("start",yesterdayTimeForCalc); |
|
|
|
mapForYesterday.put("end",nowTimeForCalc); |
|
|
|
Map<String, Object> mapForYesterday = new HashMap<>(); |
|
|
|
mapForYesterday.put("start", yesterdayTimeForCalc); |
|
|
|
mapForYesterday.put("end", nowTimeForCalc); |
|
|
|
|
|
|
|
// 查询今天目前为止的入库
|
|
|
|
List<ApplicationInRecordP> applicationInRecordPForToday = depositoryRecordMapper.findApplicationInRecordPForAPeriodOfTime(mapForToday); |
|
|
|
@ -269,27 +280,27 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
for (int i = 0; i < applicationInRecordPForYesterday.size(); i++) { |
|
|
|
ApplicationInRecordP applicationInRecordP = applicationInRecordPForYesterday.get(i); |
|
|
|
sumForYesterDay += applicationInRecordP.getQuantity(); |
|
|
|
priceForYesterDay += applicationInRecordP.getPrice() * applicationInRecordP.getQuantity() ; |
|
|
|
priceForYesterDay += applicationInRecordP.getPrice() * applicationInRecordP.getQuantity(); |
|
|
|
} |
|
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
|
result.put("total",sumForToday); |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
result.put("total", sumForToday); |
|
|
|
Double ratioForCount = 0.0; |
|
|
|
Double ratioForPrice = 0.0; |
|
|
|
if(Double.compare(sumForYesterDay,0.0) != 0){ |
|
|
|
if (Double.compare(sumForYesterDay, 0.0) != 0) { |
|
|
|
ratioForCount = ((sumForToday - sumForYesterDay) / Double.parseDouble(sumForYesterDay.toString())); |
|
|
|
} |
|
|
|
if(Double.compare(priceForYesterDay,0.0) != 0){ |
|
|
|
if (Double.compare(priceForYesterDay, 0.0) != 0) { |
|
|
|
ratioForPrice = (priceForToday - priceForYesterDay) / Double.parseDouble(priceForYesterDay.toString()); |
|
|
|
} |
|
|
|
BigDecimal bgForSum = new BigDecimal(ratioForCount); |
|
|
|
BigDecimal bgForPrice = new BigDecimal(ratioForPrice); |
|
|
|
ratioForCount = bgForSum.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
ratioForPrice = bgForPrice.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
result.put("ratioForSum",ratioForCount * 100); |
|
|
|
result.put("ratioForPrice",ratioForPrice * 100); |
|
|
|
result.put("ratioForSum", ratioForCount * 100); |
|
|
|
result.put("ratioForPrice", ratioForPrice * 100); |
|
|
|
BigDecimal bgPrice = new BigDecimal(priceForToday / 100); |
|
|
|
priceForToday = bgPrice.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
result.put("price",priceForToday); |
|
|
|
result.put("price", priceForToday); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
@ -300,7 +311,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Map<String,Object> CalculateAllApplicationOutCount(String state) { |
|
|
|
public Map<String, Object> CalculateAllApplicationOutCount(String state) { |
|
|
|
// 获取昨天出库订单
|
|
|
|
// 获取当前时间
|
|
|
|
long now = System.currentTimeMillis(); |
|
|
|
@ -311,27 +322,27 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
Long yesterdayTimeForCalc = DateUtil.getYesterdayTimeForCalc(); |
|
|
|
|
|
|
|
// 用于查询今天到现在的出库记录
|
|
|
|
Map<String,Object> mapForToday = new HashMap<>(); |
|
|
|
mapForToday.put("start",nowTimeForCalc); |
|
|
|
mapForToday.put("end",now); |
|
|
|
Map<String, Object> mapForToday = new HashMap<>(); |
|
|
|
mapForToday.put("start", nowTimeForCalc); |
|
|
|
mapForToday.put("end", now); |
|
|
|
// 用于查询昨天的出库记录
|
|
|
|
Map<String,Object> mapForYesterday = new HashMap<>(); |
|
|
|
mapForYesterday.put("start",yesterdayTimeForCalc); |
|
|
|
mapForYesterday.put("end",nowTimeForCalc); |
|
|
|
Map<String, Object> mapForYesterday = new HashMap<>(); |
|
|
|
mapForYesterday.put("start", yesterdayTimeForCalc); |
|
|
|
mapForYesterday.put("end", nowTimeForCalc); |
|
|
|
|
|
|
|
// 用于最终的结果
|
|
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
// 获取今天的额度
|
|
|
|
Double priceForToday = 0.0; |
|
|
|
|
|
|
|
// 获取今天的总数
|
|
|
|
Integer countForToday = 0; |
|
|
|
Integer countForToday = 0; |
|
|
|
// 获取昨天的额度
|
|
|
|
Double priceForYesterday = 0.0; |
|
|
|
|
|
|
|
// 获取昨天的总数
|
|
|
|
Integer countForYesterday = 0; |
|
|
|
Integer countForYesterday = 0; |
|
|
|
if (state.isEmpty()) { |
|
|
|
// 获取今天为止的出库记录
|
|
|
|
List<ApplicationOutRecordP> applicationOutRecordPForToday = depositoryRecordMapper.findApplicationOutRecordPForAPeriodOfTime(mapForToday); |
|
|
|
@ -342,7 +353,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
|
|
|
|
// 昨天的出库记录数
|
|
|
|
int yesterdaySize = applicationOutRecordPForYesterday.size(); |
|
|
|
if(todaySize > 0) { |
|
|
|
if (todaySize > 0) { |
|
|
|
// 定义线程用于计算今天的记录
|
|
|
|
ExecutorService exsForToday = Executors.newFixedThreadPool(todaySize); |
|
|
|
// 结果集
|
|
|
|
@ -361,17 +372,17 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
for (int i = 0; i < todaySize; i++) { |
|
|
|
Object o = null; |
|
|
|
try { |
|
|
|
o = completionServiceForToday.take().get(); |
|
|
|
o = completionServiceForToday.take().get(); |
|
|
|
} catch (InterruptedException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} catch (ExecutionException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
countForToday += ObjectFormatUtil.toInteger(((Map<String,Object>)o).get("count")); |
|
|
|
priceForToday += Double.parseDouble(((Map<String,Object>)o).get("price").toString()); |
|
|
|
countForToday += ObjectFormatUtil.toInteger(((Map<String, Object>) o).get("count")); |
|
|
|
priceForToday += Double.parseDouble(((Map<String, Object>) o).get("price").toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
if(yesterdaySize > 0){ |
|
|
|
if (yesterdaySize > 0) { |
|
|
|
// 定义线程用于计算昨天的记录
|
|
|
|
ExecutorService exsForYesterday = Executors.newFixedThreadPool(yesterdaySize); |
|
|
|
// 结果集
|
|
|
|
@ -389,26 +400,26 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
for (int i = 0; i < yesterdaySize; i++) { |
|
|
|
Object o = null; |
|
|
|
try { |
|
|
|
o = completionServiceForYesterday.take().get(); |
|
|
|
o = completionServiceForYesterday.take().get(); |
|
|
|
} catch (InterruptedException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} catch (ExecutionException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
countForYesterday += ObjectFormatUtil.toInteger(((Map<String,Object>)o).get("count")); |
|
|
|
priceForYesterday += Double.parseDouble(((Map<String,Object>)o).get("price").toString()); |
|
|
|
countForYesterday += ObjectFormatUtil.toInteger(((Map<String, Object>) o).get("count")); |
|
|
|
priceForYesterday += Double.parseDouble(((Map<String, Object>) o).get("price").toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
// 设置今天的额度
|
|
|
|
result.put("price",priceForToday); |
|
|
|
result.put("count",countForToday); |
|
|
|
result.put("price", priceForToday); |
|
|
|
result.put("count", countForToday); |
|
|
|
|
|
|
|
Double ratioForCount = 0.0; |
|
|
|
Double ratioForPrice = 0.0; |
|
|
|
if(Double.compare(countForYesterday,0.0) != 0){ |
|
|
|
if (Double.compare(countForYesterday, 0.0) != 0) { |
|
|
|
ratioForCount = ((countForToday - countForYesterday) / Double.parseDouble(countForYesterday.toString())); |
|
|
|
} |
|
|
|
if(Double.compare(priceForYesterday,0.0) != 0){ |
|
|
|
if (Double.compare(priceForYesterday, 0.0) != 0) { |
|
|
|
ratioForPrice = (priceForToday - priceForYesterday) / Double.parseDouble(priceForYesterday.toString()); |
|
|
|
} |
|
|
|
BigDecimal bgForSum = new BigDecimal(ratioForCount); |
|
|
|
@ -416,9 +427,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
ratioForCount = bgForSum.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
ratioForPrice = bgForPrice.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
// 获取数量比值
|
|
|
|
result.put("radioForCount",ratioForCount * 100); |
|
|
|
result.put("radioForCount", ratioForCount * 100); |
|
|
|
// 获取金额比值
|
|
|
|
result.put("radioForPrice",ratioForPrice * 100); |
|
|
|
result.put("radioForPrice", ratioForPrice * 100); |
|
|
|
} else { |
|
|
|
// 如果获取已经出库的数量(今天)
|
|
|
|
List<ApplicationOutRecordMin> applicationOutMinForCompleteForToday = depositoryRecordMapper.findApplicationOutMinForComplete(mapForToday); |
|
|
|
@ -426,9 +437,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
List<ApplicationOutRecordMin> applicationOutMinForCompleteForYesterday = depositoryRecordMapper.findApplicationOutMinForComplete(mapForYesterday); |
|
|
|
for (int i = 0; i < applicationOutMinForCompleteForToday.size(); i++) { |
|
|
|
ApplicationOutRecordMin recordMin = applicationOutMinForCompleteForToday.get(i); |
|
|
|
countForToday += recordMin.getQuantity(); |
|
|
|
countForToday += recordMin.getQuantity(); |
|
|
|
// 获取当前出库物料
|
|
|
|
Inventory materialById = materialMapper.findInventoryByMid(recordMin.getMid()); |
|
|
|
Inventory materialById = materialMapper.findInventoryById(recordMin.getMid()); |
|
|
|
// 计算当前出库金额
|
|
|
|
double price_out = materialById.getPrice() * recordMin.getQuantity(); |
|
|
|
BigDecimal bg = new BigDecimal(price_out / 100); |
|
|
|
@ -438,7 +449,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
|
|
|
|
for (int i = 0; i < applicationOutMinForCompleteForYesterday.size(); i++) { |
|
|
|
ApplicationOutRecordMin recordMin = applicationOutMinForCompleteForYesterday.get(i); |
|
|
|
countForYesterday += recordMin.getQuantity(); |
|
|
|
countForYesterday += recordMin.getQuantity(); |
|
|
|
// 获取当前出库物料
|
|
|
|
Material materialById = materialMapper.findMaterialById(recordMin.getMid()); |
|
|
|
// 计算当前出库金额
|
|
|
|
@ -448,14 +459,14 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
priceForYesterday += price_out; |
|
|
|
} |
|
|
|
// 设置今天的额度
|
|
|
|
result.put("price",priceForToday); |
|
|
|
result.put("count",countForToday); |
|
|
|
result.put("price", priceForToday); |
|
|
|
result.put("count", countForToday); |
|
|
|
Double ratioForCount = 0.0; |
|
|
|
Double ratioForPrice = 0.0; |
|
|
|
if(Double.compare(countForYesterday,0.0) != 0){ |
|
|
|
ratioForCount = ((countForToday - countForYesterday) / Double.parseDouble(countForYesterday.toString())); |
|
|
|
if (Double.compare(countForYesterday, 0.0) != 0) { |
|
|
|
ratioForCount = ((countForToday - countForYesterday) / Double.parseDouble(countForYesterday.toString())); |
|
|
|
} |
|
|
|
if(Double.compare(priceForYesterday,0.0) != 0){ |
|
|
|
if (Double.compare(priceForYesterday, 0.0) != 0) { |
|
|
|
ratioForPrice = (priceForToday - priceForYesterday) / Double.parseDouble(priceForYesterday.toString()); |
|
|
|
} |
|
|
|
BigDecimal bgForSum = new BigDecimal(ratioForCount); |
|
|
|
@ -463,9 +474,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
ratioForCount = bgForSum.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
ratioForPrice = bgForPrice.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
// 获取数量比值
|
|
|
|
result.put("radioForCount",ratioForCount * 100); |
|
|
|
result.put("radioForCount", ratioForCount * 100); |
|
|
|
// 获取金额比值
|
|
|
|
result.put("radioForPrice",ratioForPrice * 100); |
|
|
|
result.put("radioForPrice", ratioForPrice * 100); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
@ -473,16 +484,17 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
/** |
|
|
|
* 用于计算当前主记录下的总额与数量 |
|
|
|
*/ |
|
|
|
class CalcApplicationOutInfo implements Callable<Object>{ |
|
|
|
class CalcApplicationOutInfo implements Callable<Object> { |
|
|
|
|
|
|
|
ApplicationOutRecordP mainRecord; |
|
|
|
|
|
|
|
CalcApplicationOutInfo( ApplicationOutRecordP mainRecord){ |
|
|
|
CalcApplicationOutInfo(ApplicationOutRecordP mainRecord) { |
|
|
|
this.mainRecord = mainRecord; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Object call() throws Exception { |
|
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
// 获取当前订单的子订单
|
|
|
|
List<ApplicationOutRecordMin> minList = depositoryRecordMapper.findApplicationOutRecordMinByParent(mainRecord.getId()); |
|
|
|
// 额度
|
|
|
|
@ -491,17 +503,17 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
Integer count = 0; |
|
|
|
for (int i = 0; i < minList.size(); i++) { |
|
|
|
ApplicationOutRecordMin recordMin = minList.get(i); |
|
|
|
count +=recordMin.getQuantity(); |
|
|
|
count += recordMin.getQuantity(); |
|
|
|
// 获取当前出库物料
|
|
|
|
Inventory materialById = materialMapper.findInventoryByMid(recordMin.getMid()); |
|
|
|
Inventory materialById = materialMapper.findInventoryById(recordMin.getMid()); |
|
|
|
// 计算当前出库金额
|
|
|
|
double price_out = materialById.getPrice() * recordMin.getQuantity(); |
|
|
|
BigDecimal bg = new BigDecimal(price_out / 100); |
|
|
|
price_out = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
price += price_out; |
|
|
|
} |
|
|
|
result.put("count",count); |
|
|
|
result.put("price",price); |
|
|
|
result.put("count", count); |
|
|
|
result.put("price", price); |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -525,6 +537,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 获取当前物料基本信息
|
|
|
|
Integer mid = ObjectFormatUtil.toInteger(map.get("mid")); |
|
|
|
Material materialById = materialMapper.findMaterialById(mid); |
|
|
|
String unit = (String) map.get("unit"); |
|
|
|
if("-1".equals(unit)){ |
|
|
|
map.put("unit",materialById.getUnit()); |
|
|
|
} |
|
|
|
if (placeById.getMax() - placeById.getQuantity() > quantity) { |
|
|
|
// 如果当前库位还能存放
|
|
|
|
// 入库
|
|
|
|
@ -543,9 +559,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
if (map.containsKey("producedDate")) { |
|
|
|
Long producedDate = Long.valueOf(0); |
|
|
|
Object s = map.get("producedDate"); |
|
|
|
if(s == null || "".equals(s.toString())){ |
|
|
|
if (s == null || "".equals(s.toString())) { |
|
|
|
producedDate = Long.valueOf(0); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
producedDate = DateUtil.DateTimeByDayToTimeStamp(s.toString()); |
|
|
|
insertProducedDate.put("producedDate", producedDate); |
|
|
|
} |
|
|
|
@ -553,13 +569,13 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 查找当前物料id与生产日期的对应关系
|
|
|
|
|
|
|
|
MaterialAndProducedDate materialAndProducedDateByMidAndProducedDate = materialMapper.findMaterialAndProducedDateByMidAndProducedDate(insertProducedDate); |
|
|
|
if(materialAndProducedDateByMidAndProducedDate != null){ |
|
|
|
if (materialAndProducedDateByMidAndProducedDate != null) { |
|
|
|
// 增加当前数量
|
|
|
|
materialAndProducedDateByMidAndProducedDate.setQuantity(materialAndProducedDateByMidAndProducedDate.getQuantity() + quantity); |
|
|
|
materialAndProducedDateByMidAndProducedDate.setInventory(materialAndProducedDateByMidAndProducedDate.getInventory() + quantity); |
|
|
|
// 修改
|
|
|
|
materialMapper.updateMaterialAndProducedDate(materialAndProducedDateByMidAndProducedDate); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
insertProducedDate.put("quantity", quantity); |
|
|
|
insertProducedDate.put("inventory", quantity); |
|
|
|
insertProducedDate.put("expendnum", 0); |
|
|
|
@ -663,9 +679,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
@Override |
|
|
|
public Integer insertApplicationOutMin(Map<String, Object> map) { |
|
|
|
Integer mid = ObjectFormatUtil.toInteger(map.get("mid")); |
|
|
|
Inventory materialById = materialMapper.findInventoryByMid(mid); |
|
|
|
Inventory materialById = materialMapper.findInventoryById(mid); |
|
|
|
map.put("depositoryId", materialById.getDepositoryId()); |
|
|
|
map.put("trueOut",0); |
|
|
|
map.put("trueOut", 0); |
|
|
|
return depositoryRecordMapper.insertApplicationOutRecordMin(map); |
|
|
|
} |
|
|
|
|
|
|
|
@ -736,7 +752,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 获取子订单中对应的库存id
|
|
|
|
Integer mid = applicationOutMinById.getMid(); |
|
|
|
// 获取库存信息
|
|
|
|
Inventory inventory = materialMapper.findInventoryByMid(mid); |
|
|
|
Inventory inventory = materialMapper.findInventoryById(mid); |
|
|
|
// 获取子订单对应的主订单
|
|
|
|
ApplicationOutRecordP record = depositoryRecordMapper.findApplicationOutRecordPById(applicationOutMinById.getParentId()); |
|
|
|
// 设置标志位
|
|
|
|
@ -826,11 +842,11 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// redisTemplate.opsForHash().put(redisMinRecordKey,"manager",userByPort.getId().toString());
|
|
|
|
|
|
|
|
// 修改当前已经出库的数量
|
|
|
|
applicationOutMinById.setTrueOut(trueOut+applicationOutMinById.getTrueOut()); |
|
|
|
if(applicationOutMinById.getQuantity() - applicationOutMinById.getTrueOut() > 0){ |
|
|
|
applicationOutMinById.setTrueOut(trueOut + applicationOutMinById.getTrueOut()); |
|
|
|
if (applicationOutMinById.getQuantity() - applicationOutMinById.getTrueOut() > 0) { |
|
|
|
// 如果当前子订单中的物料并未完全出库
|
|
|
|
depositoryRecordMapper.updateApplicationOutRecordMin(applicationOutMinById); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
// 如果完成出库
|
|
|
|
|
|
|
|
// 获取当前订单中所有管理员
|
|
|
|
@ -1079,7 +1095,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 获取对应的物料编号
|
|
|
|
Integer mid = applicationOutRecordMin.getMid(); |
|
|
|
// 获取物料信息
|
|
|
|
Inventory materialById = materialMapper.findInventoryByMid(mid); |
|
|
|
Inventory materialById = materialMapper.findInventoryById(mid); |
|
|
|
// 获取该物料所处仓库的仓库管理员
|
|
|
|
List<Integer> userIdByDid = new ArrayList<>(); |
|
|
|
userIdByDid = roleService.findUserIdByDid(materialById.getDepositoryId()); |
|
|
|
@ -1157,8 +1173,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 将当前redis中存储的spno删除
|
|
|
|
redisTemplate.delete(spNo); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
// 如果是部门负责人
|
|
|
|
|
|
|
|
String departmentheadTime = recordP.getDepartmentheadTime(); |
|
|
|
@ -1215,7 +1230,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
public Integer transferApply(Map<String, Object> map, UserByPort userByPort) { |
|
|
|
Integer mid = ObjectFormatUtil.toInteger(map.get("mid")); |
|
|
|
Double quantity = Double.parseDouble((String) map.get("quantity")); |
|
|
|
Inventory material = materialMapper.findInventoryByMid(mid); |
|
|
|
Inventory material = materialMapper.findInventoryById(mid); |
|
|
|
map.put("depositoryId", material.getDepositoryId()); |
|
|
|
map.put("mid", mid); |
|
|
|
map.put("state", "待部门负责人审核"); |
|
|
|
@ -1260,7 +1275,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
map.remove("id"); |
|
|
|
map.put("parentId", id); |
|
|
|
} |
|
|
|
map.put("trueOut",0); |
|
|
|
map.put("trueOut", 0); |
|
|
|
return depositoryRecordMapper.insertApplicationOutRecordMin(map); |
|
|
|
} |
|
|
|
|
|
|
|
@ -1746,7 +1761,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
TransferRecord transferRecor = transferRecordMapper.findTransferRecordById(recordMin.getTransferId()); |
|
|
|
Integer mid = transferRecor.getMid(); |
|
|
|
// 获取库存信息
|
|
|
|
Inventory material = materialMapper.findInventoryByMid(mid); |
|
|
|
Inventory material = materialMapper.findInventoryById(mid); |
|
|
|
param.put("mcode", material.getCode()); |
|
|
|
param.put("depositoryId", transferRecor.getToId()); |
|
|
|
List<Inventory> materiallist = materialMapper.findInventory(param); |
|
|
|
@ -1768,7 +1783,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
insert.put("quantity", quantity); |
|
|
|
insert.put("amounts", quantity * material.getPrice()); |
|
|
|
insert.put("depositoryCode", material.getDepositoryCode()); |
|
|
|
insert.put("producedDate",material.getProducedDate()); |
|
|
|
insert.put("producedDate", material.getProducedDate()); |
|
|
|
materialMapper.insertInventory(insert); |
|
|
|
|
|
|
|
// 查询该记录
|
|
|
|
@ -1930,7 +1945,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询当前仓库的入库记录 |
|
|
|
* @param depositoryId 待查询仓库id |
|
|
|
* |
|
|
|
* @param depositoryId 待查询仓库id |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@ -1940,6 +1956,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询当前仓库的出库记录 |
|
|
|
* |
|
|
|
* @param depositoryId 待查询仓库id |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@ -2126,8 +2143,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Map<String,Object> CalculateAllApplicationInAll() { |
|
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
|
public Map<String, Object> CalculateAllApplicationInAll() { |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
List<ApplicationInRecordP> applicationInRecordPAll = depositoryRecordMapper.findApplicationInRecordPAll(); |
|
|
|
Double sum = 0.0; |
|
|
|
Integer count = 0; |
|
|
|
@ -2139,8 +2156,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
} |
|
|
|
BigDecimal bg = new BigDecimal(sum); |
|
|
|
sum = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
result.put("price",sum); |
|
|
|
result.put("count",count); |
|
|
|
result.put("price", sum); |
|
|
|
result.put("count", count); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
|