|
|
@ -125,7 +125,13 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 获取当前入库金额
|
|
|
// 获取当前入库金额
|
|
|
Double amounts = (quantity * price * 100); |
|
|
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("amounts", amounts); |
|
|
map.put("price", price * 100); |
|
|
map.put("price", price * 100); |
|
|
String simpleTime = DateUtil.getSimpleTime(new Date()); |
|
|
String simpleTime = DateUtil.getSimpleTime(new Date()); |
|
|
@ -160,6 +166,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
} |
|
|
} |
|
|
// 将新入库的物料id记录下来
|
|
|
// 将新入库的物料id记录下来
|
|
|
map.put("newInMid", newMid); |
|
|
map.put("newInMid", newMid); |
|
|
|
|
|
|
|
|
|
|
|
// 如果包含realQuantity则代表是入库的拆单单位
|
|
|
|
|
|
if(map.containsKey("realQuantity")){ |
|
|
|
|
|
// 将入库数量修改为realQuantity
|
|
|
|
|
|
map.put("quantity",map.get("realQuantity")); |
|
|
|
|
|
} |
|
|
return depositoryRecordMapper.insertApplicationInRecord(map); |
|
|
return depositoryRecordMapper.insertApplicationInRecord(map); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -189,7 +201,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
map.put("state", "待部门负责人审核"); |
|
|
map.put("state", "待部门负责人审核"); |
|
|
if (mid != null) { |
|
|
if (mid != null) { |
|
|
// 获取当前物料
|
|
|
// 获取当前物料
|
|
|
Inventory materialById = materialMapper.findInventoryByMid(mid); |
|
|
Inventory materialById = materialMapper.findInventoryById(mid); |
|
|
int amounts = (int) ((materialById.getPrice() / 100) * quantity * 100); |
|
|
int amounts = (int) ((materialById.getPrice() / 100) * quantity * 100); |
|
|
map.put("price", amounts); |
|
|
map.put("price", amounts); |
|
|
Map<String, Object> update = new HashMap<>(); |
|
|
Map<String, Object> update = new HashMap<>(); |
|
|
@ -203,7 +215,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
Depository depositoryRecordById = depositoryMapper.findDepositoryById(materialById.getDepositoryId()); |
|
|
Depository depositoryRecordById = depositoryMapper.findDepositoryById(materialById.getDepositoryId()); |
|
|
dname = depositoryRecordById.getDname(); |
|
|
dname = depositoryRecordById.getDname(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Administration company = LinkInterfaceUtil.getCompany(userToken.getMaindeparment(), userToken); |
|
|
Administration company = LinkInterfaceUtil.getCompany(userToken.getMaindeparment(), userToken); |
|
|
String code = createCode(dname, "outOrderNumber", "out", company.getName()); |
|
|
String code = createCode(dname, "outOrderNumber", "out", company.getName()); |
|
|
map.put("code", code); |
|
|
map.put("code", code); |
|
|
@ -428,7 +439,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
ApplicationOutRecordMin recordMin = applicationOutMinForCompleteForToday.get(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(); |
|
|
double price_out = materialById.getPrice() * recordMin.getQuantity(); |
|
|
BigDecimal bg = new BigDecimal(price_out / 100); |
|
|
BigDecimal bg = new BigDecimal(price_out / 100); |
|
|
@ -480,6 +491,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
CalcApplicationOutInfo(ApplicationOutRecordP mainRecord) { |
|
|
CalcApplicationOutInfo(ApplicationOutRecordP mainRecord) { |
|
|
this.mainRecord = mainRecord; |
|
|
this.mainRecord = mainRecord; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public Object call() throws Exception { |
|
|
public Object call() throws Exception { |
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
@ -493,7 +505,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
ApplicationOutRecordMin recordMin = minList.get(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(); |
|
|
double price_out = materialById.getPrice() * recordMin.getQuantity(); |
|
|
BigDecimal bg = new BigDecimal(price_out / 100); |
|
|
BigDecimal bg = new BigDecimal(price_out / 100); |
|
|
@ -525,6 +537,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 获取当前物料基本信息
|
|
|
// 获取当前物料基本信息
|
|
|
Integer mid = ObjectFormatUtil.toInteger(map.get("mid")); |
|
|
Integer mid = ObjectFormatUtil.toInteger(map.get("mid")); |
|
|
Material materialById = materialMapper.findMaterialById(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) { |
|
|
if (placeById.getMax() - placeById.getQuantity() > quantity) { |
|
|
// 如果当前库位还能存放
|
|
|
// 如果当前库位还能存放
|
|
|
// 入库
|
|
|
// 入库
|
|
|
@ -663,7 +679,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
@Override |
|
|
@Override |
|
|
public Integer insertApplicationOutMin(Map<String, Object> map) { |
|
|
public Integer insertApplicationOutMin(Map<String, Object> map) { |
|
|
Integer mid = ObjectFormatUtil.toInteger(map.get("mid")); |
|
|
Integer mid = ObjectFormatUtil.toInteger(map.get("mid")); |
|
|
Inventory materialById = materialMapper.findInventoryByMid(mid); |
|
|
Inventory materialById = materialMapper.findInventoryById(mid); |
|
|
map.put("depositoryId", materialById.getDepositoryId()); |
|
|
map.put("depositoryId", materialById.getDepositoryId()); |
|
|
map.put("trueOut", 0); |
|
|
map.put("trueOut", 0); |
|
|
return depositoryRecordMapper.insertApplicationOutRecordMin(map); |
|
|
return depositoryRecordMapper.insertApplicationOutRecordMin(map); |
|
|
@ -736,7 +752,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 获取子订单中对应的库存id
|
|
|
// 获取子订单中对应的库存id
|
|
|
Integer mid = applicationOutMinById.getMid(); |
|
|
Integer mid = applicationOutMinById.getMid(); |
|
|
// 获取库存信息
|
|
|
// 获取库存信息
|
|
|
Inventory inventory = materialMapper.findInventoryByMid(mid); |
|
|
Inventory inventory = materialMapper.findInventoryById(mid); |
|
|
// 获取子订单对应的主订单
|
|
|
// 获取子订单对应的主订单
|
|
|
ApplicationOutRecordP record = depositoryRecordMapper.findApplicationOutRecordPById(applicationOutMinById.getParentId()); |
|
|
ApplicationOutRecordP record = depositoryRecordMapper.findApplicationOutRecordPById(applicationOutMinById.getParentId()); |
|
|
// 设置标志位
|
|
|
// 设置标志位
|
|
|
@ -1079,7 +1095,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 获取对应的物料编号
|
|
|
// 获取对应的物料编号
|
|
|
Integer mid = applicationOutRecordMin.getMid(); |
|
|
Integer mid = applicationOutRecordMin.getMid(); |
|
|
// 获取物料信息
|
|
|
// 获取物料信息
|
|
|
Inventory materialById = materialMapper.findInventoryByMid(mid); |
|
|
Inventory materialById = materialMapper.findInventoryById(mid); |
|
|
// 获取该物料所处仓库的仓库管理员
|
|
|
// 获取该物料所处仓库的仓库管理员
|
|
|
List<Integer> userIdByDid = new ArrayList<>(); |
|
|
List<Integer> userIdByDid = new ArrayList<>(); |
|
|
userIdByDid = roleService.findUserIdByDid(materialById.getDepositoryId()); |
|
|
userIdByDid = roleService.findUserIdByDid(materialById.getDepositoryId()); |
|
|
@ -1157,8 +1173,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 将当前redis中存储的spno删除
|
|
|
// 将当前redis中存储的spno删除
|
|
|
redisTemplate.delete(spNo); |
|
|
redisTemplate.delete(spNo); |
|
|
} |
|
|
} |
|
|
} |
|
|
} else { |
|
|
else { |
|
|
|
|
|
// 如果是部门负责人
|
|
|
// 如果是部门负责人
|
|
|
|
|
|
|
|
|
String departmentheadTime = recordP.getDepartmentheadTime(); |
|
|
String departmentheadTime = recordP.getDepartmentheadTime(); |
|
|
@ -1215,7 +1230,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
public Integer transferApply(Map<String, Object> map, UserByPort userByPort) { |
|
|
public Integer transferApply(Map<String, Object> map, UserByPort userByPort) { |
|
|
Integer mid = ObjectFormatUtil.toInteger(map.get("mid")); |
|
|
Integer mid = ObjectFormatUtil.toInteger(map.get("mid")); |
|
|
Double quantity = Double.parseDouble((String) map.get("quantity")); |
|
|
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("depositoryId", material.getDepositoryId()); |
|
|
map.put("mid", mid); |
|
|
map.put("mid", mid); |
|
|
map.put("state", "待部门负责人审核"); |
|
|
map.put("state", "待部门负责人审核"); |
|
|
@ -1746,7 +1761,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
TransferRecord transferRecor = transferRecordMapper.findTransferRecordById(recordMin.getTransferId()); |
|
|
TransferRecord transferRecor = transferRecordMapper.findTransferRecordById(recordMin.getTransferId()); |
|
|
Integer mid = transferRecor.getMid(); |
|
|
Integer mid = transferRecor.getMid(); |
|
|
// 获取库存信息
|
|
|
// 获取库存信息
|
|
|
Inventory material = materialMapper.findInventoryByMid(mid); |
|
|
Inventory material = materialMapper.findInventoryById(mid); |
|
|
param.put("mcode", material.getCode()); |
|
|
param.put("mcode", material.getCode()); |
|
|
param.put("depositoryId", transferRecor.getToId()); |
|
|
param.put("depositoryId", transferRecor.getToId()); |
|
|
List<Inventory> materiallist = materialMapper.findInventory(param); |
|
|
List<Inventory> materiallist = materialMapper.findInventory(param); |
|
|
@ -1930,6 +1945,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 查询当前仓库的入库记录 |
|
|
* 查询当前仓库的入库记录 |
|
|
|
|
|
* |
|
|
* @param depositoryId 待查询仓库id |
|
|
* @param depositoryId 待查询仓库id |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
@ -1940,6 +1956,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 查询当前仓库的出库记录 |
|
|
* 查询当前仓库的出库记录 |
|
|
|
|
|
* |
|
|
* @param depositoryId 待查询仓库id |
|
|
* @param depositoryId 待查询仓库id |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
|