Browse Source

修改入库时单价提交功能

lwx_dev
erdanergou 3 years ago
parent
commit
69e3655e9d
  1. 11
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java
  2. 111
      src/main/java/com/dreamchaser/depository_manage/controller/DownLoadFileController.java
  3. 36
      src/main/java/com/dreamchaser/depository_manage/controller/PageController.java
  4. 8
      src/main/java/com/dreamchaser/depository_manage/entity/ExcelInfoByInventory.java
  5. 16
      src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml
  6. 120
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  7. 27
      src/main/java/com/dreamchaser/depository_manage/service/impl/ExcelServiceImpl.java
  8. 161
      src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java
  9. 2
      src/main/resources/static/js/JcPrinter/index_Demo.js
  10. 62
      src/main/resources/templates/pages/application/application-in.html
  11. 31
      src/main/resources/templates/pages/application/application-in_back.html
  12. 38
      src/main/resources/templates/pages/application/application-in_scanQrCode.html
  13. 1
      src/main/resources/templates/pages/application/application_multi.html
  14. 5
      src/main/resources/templates/pages/depository/table-stock.html
  15. 7
      src/main/resources/templates/pages/material/material-view.html

11
src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java

@ -222,7 +222,6 @@ public class DepositoryRecordController {
insert.put("depositoryId", map.get("depositoryId" + temp)); insert.put("depositoryId", map.get("depositoryId" + temp));
insert.put("applyRemark", map.get("applyRemark" + temp)); insert.put("applyRemark", map.get("applyRemark" + temp));
insert.put("code", map.get("code" + temp)); insert.put("code", map.get("code" + temp));
insert.put("price", map.get("price" + temp).toString());
insert.put("producedDate", map.get("producedDate" + temp)); insert.put("producedDate", map.get("producedDate" + temp));
insert.put("qrCode", map.get("qrCode" + temp)); insert.put("qrCode", map.get("qrCode" + temp));
insert.put("barCode", map.get("barCode" + temp)); insert.put("barCode", map.get("barCode" + temp));
@ -466,7 +465,11 @@ public class DepositoryRecordController {
UserByPort userToken = (UserByPort) request.getAttribute("userToken"); UserByPort userToken = (UserByPort) request.getAttribute("userToken");
List<ApplicationInRecordP> list = depositoryRecordService.findApplicationInRecordPByUser(userToken, map); List<ApplicationInRecordP> list = depositoryRecordService.findApplicationInRecordPByUser(userToken, map);
for (ApplicationInRecordP applicationInRecordP : list) { for (ApplicationInRecordP applicationInRecordP : list) {
if (applicationInRecordP.getPrice() != null) {
applicationInRecordP.setPrice(applicationInRecordP.getPrice() / 100); applicationInRecordP.setPrice(applicationInRecordP.getPrice() / 100);
} else {
applicationInRecordP.setPrice(0.0);
}
} }
return new RestResponse(list, depositoryRecordService.findApplicationInRecordPCountByUser(userToken, map), 200); return new RestResponse(list, depositoryRecordService.findApplicationInRecordPCountByUser(userToken, map), 200);
} }
@ -881,15 +884,12 @@ public class DepositoryRecordController {
} }
resultIds.add(2); resultIds.add(2);
return new RestResponse(resultIds, 0, 2); return new RestResponse(resultIds, 0, 2);
} } else {
else {
throw new MyException("所需请求参数缺失!"); throw new MyException("所需请求参数缺失!");
} }
} }
/** /**
* 自动生成出入库订单 * 自动生成出入库订单
* *
@ -931,7 +931,6 @@ public class DepositoryRecordController {
ap.setVersion(materialById.getVersion()); ap.setVersion(materialById.getVersion());
ap.setMname(materialById.getMname()); ap.setMname(materialById.getMname());
ap.setCode(materialById.getCode()); ap.setCode(materialById.getCode());
ap.setPrice(materialById.getPrice());
ap.setApplicant(userToken.getId()); ap.setApplicant(userToken.getId());
ap.setQuantity(1.0); ap.setQuantity(1.0);
ap.setUnit("-1"); ap.setUnit("-1");

111
src/main/java/com/dreamchaser/depository_manage/controller/DownLoadFileController.java

@ -22,8 +22,8 @@ public class DownLoadFileController {
* @param response * @param response
* @功能描述 下载文件: * @功能描述 下载文件:
*/ */
@RequestMapping("/download") @RequestMapping("/zipDownload")
public void download(HttpServletRequest request,HttpServletResponse response) { public void zipDownload(HttpServletRequest request,HttpServletResponse response) {
try { try {
String path = "static/upload/PrintServer.zip"; String path = "static/upload/PrintServer.zip";
@ -53,4 +53,111 @@ public class DownLoadFileController {
} }
} }
/**
* @param response
* @功能描述 下载文件:
*/
@RequestMapping("/materialImportDownload")
public void materialImportDownload(HttpServletRequest request,HttpServletResponse response) {
try {
String path = "static/upload/materialImport.xlsx";
String fileName = "materialImport.xlsx";
response.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
response.setContentType("content-type:octet-stream");
/* .getClassLoader() 方法是在静态文件路径添加一个/ */
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(path);
OutputStream outputStream = response.getOutputStream();
try {
byte[] buffer = new byte[1024];
int len;
assert inputStream != null;
while ((len = inputStream.read(buffer)) != -1) { /* 将流中内容写出去 .*/
outputStream.write(buffer, 0, len);
}
}catch (IOException e){
e.printStackTrace();
}finally {
assert inputStream != null;
inputStream.close();
outputStream.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* @param response
* @功能描述 下载文件:
*/
@RequestMapping("/materialTypeImportDownload")
public void materialTypeImportDownload(HttpServletRequest request,HttpServletResponse response) {
try {
String path = "static/upload/materialTypeImport.xlsx";
String fileName = "materialTypeImport.xlsx";
response.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
response.setContentType("content-type:octet-stream");
/* .getClassLoader() 方法是在静态文件路径添加一个/ */
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(path);
OutputStream outputStream = response.getOutputStream();
try {
byte[] buffer = new byte[1024];
int len;
assert inputStream != null;
while ((len = inputStream.read(buffer)) != -1) { /* 将流中内容写出去 .*/
outputStream.write(buffer, 0, len);
}
}catch (IOException e){
e.printStackTrace();
}finally {
assert inputStream != null;
inputStream.close();
outputStream.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* @param response
* @功能描述 下载文件:
*/
@RequestMapping("/inventoryImportDownload")
public void inventoryImportDownload(HttpServletRequest request,HttpServletResponse response) {
try {
String path = "static/upload/inventoryImport.xlsx";
String fileName = "inventoryImport.xlsx";
response.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
response.setContentType("content-type:octet-stream");
/* .getClassLoader() 方法是在静态文件路径添加一个/ */
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(path);
OutputStream outputStream = response.getOutputStream();
try {
byte[] buffer = new byte[1024];
int len;
assert inputStream != null;
while ((len = inputStream.read(buffer)) != -1) { /* 将流中内容写出去 .*/
outputStream.write(buffer, 0, len);
}
}catch (IOException e){
e.printStackTrace();
}finally {
assert inputStream != null;
inputStream.close();
outputStream.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
} }

36
src/main/java/com/dreamchaser/depository_manage/controller/PageController.java

@ -1353,7 +1353,11 @@ public class PageController {
String unit = applicationOutRecordMin.getUnit(); String unit = applicationOutRecordMin.getUnit();
if ("-1".equals(unit)) { if ("-1".equals(unit)) {
if (inventoryById.getPrice() != null) {
sumPrice += (inventoryById.getPrice() * applicationOutRecordMin.getQuantity()); sumPrice += (inventoryById.getPrice() * applicationOutRecordMin.getQuantity());
} else {
sumPrice += 0;
}
sumUnit.append(inventoryById.getUnit()).append(","); sumUnit.append(inventoryById.getUnit()).append(",");
} else { } else {
// 用于获取当前拆单记录 // 用于获取当前拆单记录
@ -1365,7 +1369,11 @@ public class PageController {
// 获取当前拆单与基础单位的进制 // 获取当前拆单与基础单位的进制
int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1);
sumUnit.append(unit).append(","); sumUnit.append(unit).append(",");
if (inventoryById.getPrice() != null) {
sumPrice += (inventoryById.getPrice() / scale * applicationOutRecordMin.getQuantity()); sumPrice += (inventoryById.getPrice() / scale * applicationOutRecordMin.getQuantity());
} else {
sumPrice += 0;
}
} }
} }
// 申请人 // 申请人
@ -1436,8 +1444,13 @@ public class PageController {
UserByPort userByPort = LinkInterfaceUtil.FindUserById(applicationInRecordPById.getApplicantId(), userToken); UserByPort userByPort = LinkInterfaceUtil.FindUserById(applicationInRecordPById.getApplicantId(), userToken);
applicationInRecordPById.setApplicantName(userByPort.getName()); applicationInRecordPById.setApplicantName(userByPort.getName());
applicationInRecordPById.setApplicantTime(DateUtil.TimeStampToDateTime(Long.valueOf(applicationInRecordPById.getApplicantTime()))); applicationInRecordPById.setApplicantTime(DateUtil.TimeStampToDateTime(Long.valueOf(applicationInRecordPById.getApplicantTime())));
if (applicationInRecordPById.getPrice() != null) {
applicationInRecordPById.setPrice(applicationInRecordPById.getPrice() / 100); applicationInRecordPById.setPrice(applicationInRecordPById.getPrice() / 100);
} else {
applicationInRecordPById.setPrice(0.0);
}
} else { } else {
// 如果是组合 // 如果是组合
@ -1483,7 +1496,10 @@ public class PageController {
String unit = recordMinP.getUnit(); String unit = recordMinP.getUnit();
if ("-1".equals(unit)) { if ("-1".equals(unit)) {
recordMinP.setUnit(inventoryById.getUnit()); recordMinP.setUnit(inventoryById.getUnit());
double price = (inventoryById.getPrice()) * recordMinP.getQuantity(); double price = 0.0;
if (inventoryById.getPrice() != null) {
price = (inventoryById.getPrice()) * recordMinP.getQuantity();
}
BigDecimal bg = new BigDecimal(price); BigDecimal bg = new BigDecimal(price);
price = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); price = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
recordMinP.setPrice(price); recordMinP.setPrice(price);
@ -1496,7 +1512,10 @@ public class PageController {
SplitInfo splitInfo = splitUnitService.findSplitInfoByMidAndUnit(paramForSplitInfo); SplitInfo splitInfo = splitUnitService.findSplitInfoByMidAndUnit(paramForSplitInfo);
// 获取当前拆单与基础单位的进制 // 获取当前拆单与基础单位的进制
int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1);
double price = (inventoryById.getPrice()) / scale * recordMinP.getQuantity(); double price = 0.0;
if (inventoryById.getPrice() != null) {
price = (inventoryById.getPrice()) / scale * recordMinP.getQuantity();
}
BigDecimal bg = new BigDecimal(price); BigDecimal bg = new BigDecimal(price);
price = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); price = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
recordMinP.setPrice(price); recordMinP.setPrice(price);
@ -1570,7 +1589,7 @@ public class PageController {
// 如果当前子订单已经处理 // 如果当前子订单已经处理
// 获取当前处理人 // 获取当前处理人
UserByPort disposer = LinkInterfaceUtil.FindUserById(checkId, userToken); UserByPort disposer = LinkInterfaceUtil.FindUserById(checkId, userToken);
outDisposer.append(disposer.getName() + ","); outDisposer.append(disposer.getName()).append(",");
recordMinP.setCheckerName(disposer.getName()); recordMinP.setCheckerName(disposer.getName());
} else { } else {
outDisposer.append("暂未处理,"); outDisposer.append("暂未处理,");
@ -1586,7 +1605,12 @@ public class PageController {
String unit = recordMinP.getUnit(); String unit = recordMinP.getUnit();
if ("-1".equals(unit)) { if ("-1".equals(unit)) {
// 如果是基础单位 // 如果是基础单位
if (inventoryById.getPrice() != null) {
sumPrice += (inventoryById.getPrice() * applicationOutRecordMin.getQuantity()); sumPrice += (inventoryById.getPrice() * applicationOutRecordMin.getQuantity());
} else {
sumPrice += 0.0;
}
} else { } else {
// 如果是拆单 // 如果是拆单
@ -1598,7 +1622,11 @@ public class PageController {
SplitInfo splitInfo = splitUnitService.findSplitInfoByMidAndUnit(paramForSplitInfo); SplitInfo splitInfo = splitUnitService.findSplitInfoByMidAndUnit(paramForSplitInfo);
// 获取当前拆单记录与基础单位的进制 // 获取当前拆单记录与基础单位的进制
int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1);
if (inventoryById.getPrice() != null) {
sumPrice += (inventoryById.getPrice() / scale * applicationOutRecordMin.getQuantity()); sumPrice += (inventoryById.getPrice() / scale * applicationOutRecordMin.getQuantity());
} else {
sumPrice += 0.0;
}
} }
recordMinPList.add(recordMinP); recordMinPList.add(recordMinP);
} }
@ -2231,7 +2259,7 @@ public class PageController {
param.put("mid", mp.getId()); param.put("mid", mp.getId());
param.put("mname", mp.getMname()); param.put("mname", mp.getMname());
param.put("code", mp.getCode()); param.put("code", mp.getCode());
param.put("price", mp.getPrice()); param.put("price", mp.getPrice() != null ? mp.getPrice() : 0);
param.put("version", mp.getVersion()); param.put("version", mp.getVersion());
param.put("codeFlag", 1); param.put("codeFlag", 1);
List<MaterialAndBarCode> materialByBarCodeByCondition = materialService.findMaterialByBarCodeByCondition(param); List<MaterialAndBarCode> materialByBarCodeByCondition = materialService.findMaterialByBarCodeByCondition(param);

8
src/main/java/com/dreamchaser/depository_manage/entity/ExcelInfoByInventory.java

@ -39,14 +39,6 @@ public class ExcelInfoByInventory {
@ExcelValid(message = "数量未填写") @ExcelValid(message = "数量未填写")
private String quantity; private String quantity;
/** 总金额 */
@ExcelProperty("总金额")
private String amounts;
/** 单价 */
@ExcelProperty("单价")
private String price;
/** 仓库编码 */ /** 仓库编码 */
@ExcelProperty(value = "库位码") @ExcelProperty(value = "库位码")
private String depositoryCode; private String depositoryCode;

16
src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml

@ -125,16 +125,16 @@
<!-- 表查询字段,包括物料类型 --> <!-- 表查询字段,包括物料类型 -->
<sql id="allColumnsAndTypeName"> <sql id="allColumnsAndTypeName">
id,depository_id,mname,quantity,price,type_id,state,code ,version ,amounts ,unit ,texture,tname,depositoryCode,dname,producedDate,shelfLife,productionPlace,brand,remark id,depository_id,mname,quantity,price,type_id,state,code ,version ,unit ,texture,tname,depositoryCode,dname,producedDate,shelfLife,productionPlace,brand,remark
</sql> </sql>
<!-- 表查询字段,包括物料类型 用于视图--> <!-- 表查询字段,包括物料类型 用于视图-->
<sql id="allColumnsAndTypeNameOnView"> <sql id="allColumnsAndTypeNameOnView">
id,depository_id,mname,quantity,price,type_id,state,tname,dname,version,amounts ,unit ,texture,code,depositoryCode,producedDate,shelfLife,productionPlace,brand,remark id,depository_id,mname,quantity,price,type_id,state,tname,dname,version ,unit ,texture,code,depositoryCode,producedDate,shelfLife,productionPlace,brand,remark
</sql> </sql>
<!-- 表查询字段,包括物料类型 用于库存视图--> <!-- 表查询字段,包括物料类型 用于库存视图-->
<sql id="allColumnsAndTypeNameOnViewByInventory"> <sql id="allColumnsAndTypeNameOnViewByInventory">
id,mid,depositoryId,mname,quantity,price,mtid,mstate,tname,dname,version,amounts ,unit ,texture,mcode,depositoryCode,producedDate,shelfLife,productionPlace,brand,remark,numberOfTemporary id,mid,depositoryId,mname,quantity,price,mtid,mstate,tname,dname,version ,unit ,texture,mcode,depositoryCode,producedDate,shelfLife,productionPlace,brand,remark,numberOfTemporary
</sql> </sql>
<sql id="allColumnsByMaterialAndProducedDate"> <sql id="allColumnsByMaterialAndProducedDate">
@ -766,13 +766,11 @@
</insert> </insert>
<!-- 插入数据 --> <!-- 插入数据 -->
<insert id="insertInventory" useGeneratedKeys="true" keyProperty="id"> <insert id="insertInventory" useGeneratedKeys="true" keyProperty="id">
insert into inventory(id,mid,quantity,amounts,price,producedDate,depository_id) insert into inventory(id,mid,quantity,producedDate,depository_id)
values ( values (
#{id}, #{id},
#{mid}, #{mid},
#{quantity}, #{quantity},
#{amounts},
#{price},
#{producedDate}, #{producedDate},
#{depositoryId} #{depositoryId}
) )
@ -971,12 +969,6 @@
<if test="quantity != null"> <if test="quantity != null">
quantity = #{quantity}, quantity = #{quantity},
</if> </if>
<if test="price != null">
price = #{price},
</if>
<if test="amounts != null and amounts != ''">
amounts = #{amounts},
</if>
<if test="numberOfTemporary != null"> <if test="numberOfTemporary != null">
number_of_temporary = #{numberOfTemporary} number_of_temporary = #{numberOfTemporary}
</if> </if>

120
src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java

@ -88,7 +88,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
param.put("mname", mname); param.put("mname", mname);
List<Material> list = materialMapper.findMaterialByCondition(param); List<Material> list = materialMapper.findMaterialByCondition(param);
Material material = list.get(0); Material material = list.get(0);
if (material.getPrice() != null) {
map.put("price", (material.getPrice() / 100) * quantity * 100); map.put("price", (material.getPrice() / 100) * quantity * 100);
} else {
map.put("price", 0);
}
return depositoryRecordMapper.insertDepositoryRecord(map); return depositoryRecordMapper.insertDepositoryRecord(map);
} }
@ -111,7 +116,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
//构造单号 //构造单号
String code = createCode(depositoryRecordById.getDname(), "InOrderNumber", "in", ""); String code = createCode(depositoryRecordById.getDname(), "InOrderNumber", "in", "");
Double quantity = Double.parseDouble((String) map.get("quantity")); Double quantity = Double.parseDouble((String) map.get("quantity"));
double price = Double.parseDouble((String) map.get("price"));
Integer mid = ObjectFormatUtil.toInteger(map.get("mid")); Integer mid = ObjectFormatUtil.toInteger(map.get("mid"));
// 根据物料id查询物料 // 根据物料id查询物料
Material material = materialMapper.findMaterialById(mid); Material material = materialMapper.findMaterialById(mid);
@ -134,18 +138,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
param.put("mcode", material.getCode()); param.put("mcode", material.getCode());
// 判断该仓库中有无该物物料 // 判断该仓库中有无该物物料
List<Inventory> materialByCondition = materialMapper.findInventory(param); List<Inventory> materialByCondition = materialMapper.findInventory(param);
// 获取当前入库金额
Double amounts = (quantity * price * 100);
// 获取平均价格
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()); String simpleTime = DateUtil.getSimpleTime(new Date());
map.put("applicant_time", DateUtil.DateTimeToTimeStamp(simpleTime)); map.put("applicant_time", DateUtil.DateTimeToTimeStamp(simpleTime));
map.put("code", code); map.put("code", code);
@ -155,11 +149,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Integer newMid = 0; Integer newMid = 0;
if (materialByCondition.size() > 0) { // 如果当前存在 if (materialByCondition.size() > 0) { // 如果当前存在
Inventory mt = materialByCondition.get(0); Inventory mt = materialByCondition.get(0);
map.put("oldPrice", mt.getPrice());
map.put("mid", mt.getMid()); map.put("mid", mt.getMid());
mt.setAmounts(mt.getAmounts() + amounts);
mt.setQuantity((int) (mt.getQuantity() + quantity)); mt.setQuantity((int) (mt.getQuantity() + quantity));
mt.setPrice(avgPrice);
mt.setProducedDate(producedDate); mt.setProducedDate(producedDate);
materialMapper.updateInventory(mt); materialMapper.updateInventory(mt);
newMid = mt.getId(); newMid = mt.getId();
@ -167,9 +158,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Map<String, Object> insert = new HashMap<>(); Map<String, Object> insert = new HashMap<>();
Material materialById = materialMapper.findMaterialById(mid); Material materialById = materialMapper.findMaterialById(mid);
insert.put("depositoryId", depositoryId); insert.put("depositoryId", depositoryId);
insert.put("price", avgPrice);
insert.put("quantity", quantity); insert.put("quantity", quantity);
insert.put("amounts", amounts);
insert.put("shelfLife", materialById.getShelfLife()); insert.put("shelfLife", materialById.getShelfLife());
insert.put("producedDate", producedDate); insert.put("producedDate", producedDate);
insert.put("mid", map.get("mid")); insert.put("mid", map.get("mid"));
@ -218,8 +207,11 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if (mid != null) { if (mid != null) {
// 获取当前物料 // 获取当前物料
Inventory materialById = materialMapper.findInventoryById(mid); Inventory materialById = materialMapper.findInventoryById(mid);
map.put("price", 0);
if (materialById.getPrice() != null) {
int amounts = (int) ((materialById.getPrice() / 100) * quantity * 100); int amounts = (int) ((materialById.getPrice() / 100) * quantity * 100);
map.put("price", amounts); map.put("price", amounts);
}
Depository depositoryRecordById = depositoryMapper.findDepositoryById(materialById.getDepositoryId()); Depository depositoryRecordById = depositoryMapper.findDepositoryById(materialById.getDepositoryId());
dname = depositoryRecordById.getDname(); dname = depositoryRecordById.getDname();
} }
@ -386,7 +378,11 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 获取当前入库类型(1物料2组合) // 获取当前入库类型(1物料2组合)
Integer flagForGroup = applicationInRecordP.getFlagForGroup(); Integer flagForGroup = applicationInRecordP.getFlagForGroup();
sumForToday += applicationInRecordP.getQuantity(); sumForToday += applicationInRecordP.getQuantity();
if (applicationInRecordP.getPrice() != null) {
priceForToday += applicationInRecordP.getPrice() * applicationInRecordP.getQuantity(); priceForToday += applicationInRecordP.getPrice() * applicationInRecordP.getQuantity();
} else {
priceForToday += 0;
}
} }
@ -394,7 +390,11 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
for (int i = 0; i < applicationInRecordPForYesterday.size(); i++) { for (int i = 0; i < applicationInRecordPForYesterday.size(); i++) {
ApplicationInRecordP applicationInRecordP = applicationInRecordPForYesterday.get(i); ApplicationInRecordP applicationInRecordP = applicationInRecordPForYesterday.get(i);
sumForYesterDay += applicationInRecordP.getQuantity(); sumForYesterDay += applicationInRecordP.getQuantity();
if (applicationInRecordP.getPrice() != null) {
priceForYesterDay += applicationInRecordP.getPrice() * applicationInRecordP.getQuantity(); priceForYesterDay += applicationInRecordP.getPrice() * applicationInRecordP.getQuantity();
} else {
priceForYesterDay += 0;
}
} }
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
result.put("total", sumForToday); result.put("total", sumForToday);
@ -979,8 +979,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
restResponse.setData(""); restResponse.setData("");
restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足")); restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足"));
} }
} } else {
else {
// 如果是拆单后的出库 // 如果是拆单后的出库
// 用于获取对应的拆单记录 // 用于获取对应的拆单记录
@ -1121,9 +1120,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
inventory.setQuantity(inventory.getQuantity() - 1); inventory.setQuantity(inventory.getQuantity() - 1);
// 重新计算总额
inventory.setAmounts(inventory.getQuantity() * inventory.getPrice());
// 修改库存记录 // 修改库存记录
materialMapper.updateInventory(inventory); materialMapper.updateInventory(inventory);
@ -1218,8 +1214,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 令库存-1 // 令库存-1
inventory.setQuantity(inventory.getQuantity() - surplus_redundant); inventory.setQuantity(inventory.getQuantity() - surplus_redundant);
// 重新计算总额
inventory.setAmounts(inventory.getQuantity() * inventory.getPrice());
// 修改库存记录 // 修改库存记录
materialMapper.updateInventory(inventory); materialMapper.updateInventory(inventory);
@ -1258,8 +1252,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
} }
} }
} } else {
else {
// 如果拆单库存处理记录不存在 // 如果拆单库存处理记录不存在
int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1);
@ -1271,8 +1264,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 获取剩余数目 // 获取剩余数目
int residue_realQuantity = residue * scale - trueOut; int residue_realQuantity = residue * scale - trueOut;
// 设置新总额
inventory.setAmounts(inventory.getAmounts() - residue * inventory.getPrice());
// 设置新库存 // 设置新库存
inventory.setQuantity(inventory.getQuantity() - residue); inventory.setQuantity(inventory.getQuantity() - residue);
@ -1295,7 +1286,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Map<String, Object> insertForSplitInventory = new HashMap<>(); Map<String, Object> insertForSplitInventory = new HashMap<>();
insertForSplitInventory.put("mid", inventory.getMid()); insertForSplitInventory.put("mid", inventory.getMid());
insertForSplitInventory.put("mcode", inventory.getCode()); insertForSplitInventory.put("mcode", inventory.getCode());
if (inventory.getPrice() != null) {
insertForSplitInventory.put("price", inventory.getPrice() / scale); insertForSplitInventory.put("price", inventory.getPrice() / scale);
} else {
insertForSplitInventory.put("price", 0);
}
insertForSplitInventory.put("quantity", residue_realQuantity); insertForSplitInventory.put("quantity", residue_realQuantity);
insertForSplitInventory.put("unit", unit); insertForSplitInventory.put("unit", unit);
insertForSplitInventory.put("depositoryId", applicationOutMinById.getDepositoryId()); insertForSplitInventory.put("depositoryId", applicationOutMinById.getDepositoryId());
@ -1523,8 +1519,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
materialAndPlace.setQuantity(materialAndPlace.getQuantity() - inventory_quantity); materialAndPlace.setQuantity(materialAndPlace.getQuantity() - inventory_quantity);
inventory.setQuantity(inventory.getQuantity() - inventory_quantity); inventory.setQuantity(inventory.getQuantity() - inventory_quantity);
// 重新设置总额
inventory.setAmounts(inventory.getAmounts() - inventory_quantity * inventory.getPrice());
// 修改库存数量 // 修改库存数量
materialMapper.updateInventory(inventory); materialMapper.updateInventory(inventory);
@ -1554,8 +1548,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 设置当前库存数量 // 设置当前库存数量
materialAndPlace.setQuantity(materialAndPlace.getQuantity() - surplus_redundant); materialAndPlace.setQuantity(materialAndPlace.getQuantity() - surplus_redundant);
inventory.setQuantity(inventory.getQuantity() - surplus_redundant); inventory.setQuantity(inventory.getQuantity() - surplus_redundant);
// 设置当前总额
inventory.setAmounts(inventory.getPrice() * inventory.getQuantity());
// 修改库存数量 // 修改库存数量
materialMapper.updateInventory(inventory); materialMapper.updateInventory(inventory);
@ -1917,8 +1909,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();
@ -1999,6 +1990,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
/** /**
* 根据主键查询转移记录 * 根据主键查询转移记录
*
* @param id * @param id
* @return * @return
*/ */
@ -2024,7 +2016,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
map.put("state", "待部门负责人审核"); map.put("state", "待部门负责人审核");
String simpleTime = DateUtil.getSimpleTime(new Date()); String simpleTime = DateUtil.getSimpleTime(new Date());
map.put("applicantTime", DateUtil.DateTimeToTimeStamp(simpleTime)); map.put("applicantTime", DateUtil.DateTimeToTimeStamp(simpleTime));
if (material.getPrice() != null) {
map.put("price", material.getPrice() * quantity * 100); map.put("price", material.getPrice() * quantity * 100);
} else {
map.put("price", 0);
}
map.put("istransfer", 1); map.put("istransfer", 1);
map.put("fromId", material.getDepositoryId()); map.put("fromId", material.getDepositoryId());
String fromPlaceId = (String) map.get("fromPlaceId"); String fromPlaceId = (String) map.get("fromPlaceId");
@ -2168,7 +2165,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
}).start(); }).start();
} else { } else {
// 如果没有通过 // 如果没有通过
updateInventoryForOutRefused(record); updateInventoryForOutRefused(record);
@ -2211,8 +2207,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
qyWxOperationService.sendMessageForOtherUserByCard(ObjectFormatUtil.toInteger(id), s, userAgent, 1); qyWxOperationService.sendMessageForOtherUserByCard(ObjectFormatUtil.toInteger(id), s, userAgent, 1);
} }
}).start(); }).start();
} } else {
else {
String result = ""; String result = "";
// 开启线程更改其他用户卡片模板样式 // 开启线程更改其他用户卡片模板样式
String simpleTime = DateUtil.getSimpleTime(new Date()); String simpleTime = DateUtil.getSimpleTime(new Date());
@ -2645,7 +2640,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if (inventories.size() > 0) { if (inventories.size() > 0) {
// 如果在该仓库 // 如果在该仓库
if (inventoryById.getPrice() != null) {
map.put("price", inventoryById.getPrice().toString()); map.put("price", inventoryById.getPrice().toString());
} else {
map.put("price", "0");
}
// 进行入库操作 // 进行入库操作
applicationInPlace(map); applicationInPlace(map);
@ -2656,14 +2656,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Integer quantity = ObjectFormatUtil.toInteger(map.get("quantity")); Integer quantity = ObjectFormatUtil.toInteger(map.get("quantity"));
// 转移到的仓库 // 转移到的仓库
insert.put("depositoryId", transferRecord.getToId()); insert.put("depositoryId", transferRecord.getToId());
// 单价
insert.put("price", inventoryById.getPrice());
// 库存物料 // 库存物料
insert.put("mid", inventoryById.getMid()); insert.put("mid", inventoryById.getMid());
// 数量 // 数量
insert.put("quantity", quantity); insert.put("quantity", quantity);
// 总额
insert.put("amounts", quantity * inventoryById.getPrice());
// 仓库编码 // 仓库编码
insert.put("depositoryCode", inventoryById.getDepositoryCode()); insert.put("depositoryCode", inventoryById.getDepositoryCode());
// 生产日期 // 生产日期
@ -2787,7 +2783,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 进行修改当前拆单库存数量 // 进行修改当前拆单库存数量
map.put("newInMid", placeAndMaterial.getId()); map.put("newInMid", placeAndMaterial.getId());
if (inventoryById.getPrice() != null) {
map.put("price", inventoryById.getPrice() / scaleQuantity); map.put("price", inventoryById.getPrice() / scaleQuantity);
} else {
map.put("price", 0);
}
// 实际入库数量 // 实际入库数量
map.put("realQuantity", quantity.toString()); map.put("realQuantity", quantity.toString());
@ -2859,7 +2860,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 进行修改当前拆单库存数量 // 进行修改当前拆单库存数量
map.put("newInMid", placeAndMaterial.getId()); map.put("newInMid", placeAndMaterial.getId());
if (inventoryById.getPrice() != null) {
map.put("price", inventoryById.getPrice() / scaleQuantity); map.put("price", inventoryById.getPrice() / scaleQuantity);
} else {
map.put("price", 0);
}
// 实际入库数量 // 实际入库数量
map.put("realQuantity", quantity.toString()); map.put("realQuantity", quantity.toString());
@ -2902,7 +2908,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
} else { } else {
// 如果不小于 // 如果不小于
if (inventoryById.getPrice() != null) {
map.put("price", inventoryById.getPrice() / scaleQuantity); map.put("price", inventoryById.getPrice() / scaleQuantity);
} else {
map.put("price", 0);
}
updateSplitInventoryForMoreScale(inventoryById, map, splitInfo, quantity, insertForMaterialAndPlace, insertForSplitInventory); updateSplitInventoryForMoreScale(inventoryById, map, splitInfo, quantity, insertForMaterialAndPlace, insertForSplitInventory);
} }
@ -2915,10 +2926,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 用于添加一条库存记录 // 用于添加一条库存记录
Map<String, Object> insertForInventory = new HashMap<>(); Map<String, Object> insertForInventory = new HashMap<>();
insertForInventory.put("depositoryId", transferRecord.getToId()); insertForInventory.put("depositoryId", transferRecord.getToId());
insertForInventory.put("price", inventoryById.getPrice());
insertForInventory.put("mid", inventoryById.getMid()); insertForInventory.put("mid", inventoryById.getMid());
insertForInventory.put("quantity", 0); insertForInventory.put("quantity", 0);
insertForInventory.put("amounts", 0);
insertForInventory.put("depositoryCode", inventoryById.getDepositoryCode()); insertForInventory.put("depositoryCode", inventoryById.getDepositoryCode());
insertForInventory.put("producedDate", inventoryById.getProducedDate()); insertForInventory.put("producedDate", inventoryById.getProducedDate());
// 添加一条库存记录 // 添加一条库存记录
@ -2949,7 +2958,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
splitUnitMapper.addSplitInventory(insertForSplitInventory); splitUnitMapper.addSplitInventory(insertForSplitInventory);
} else { } else {
// 如果不小于 // 如果不小于
if (inventoryById.getPrice() != null) {
map.put("price", inventoryById.getPrice() / scaleQuantity); map.put("price", inventoryById.getPrice() / scaleQuantity);
} else {
map.put("price", 0);
}
updateSplitInventoryForMoreScale(inventoryById, map, splitInfo, quantity, insertForMaterialAndPlace, insertForSplitInventory); updateSplitInventoryForMoreScale(inventoryById, map, splitInfo, quantity, insertForMaterialAndPlace, insertForSplitInventory);
} }
@ -3500,7 +3514,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Integer count = 0; Integer count = 0;
for (int i = 0; i < applicationInRecordPAll.size(); i++) { for (int i = 0; i < applicationInRecordPAll.size(); i++) {
ApplicationInRecordP applicationInRecordP = applicationInRecordPAll.get(i); ApplicationInRecordP applicationInRecordP = applicationInRecordPAll.get(i);
double price = applicationInRecordP.getPrice(); double price = 0.0;
if (applicationInRecordP.getPrice() != null) {
price = applicationInRecordP.getPrice();
}
sum += price * applicationInRecordP.getQuantity() / 100; sum += price * applicationInRecordP.getQuantity() / 100;
count += applicationInRecordP.getQuantity(); count += applicationInRecordP.getQuantity();
} }
@ -3533,7 +3550,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
ApplicationOutRecordMin applicationOutRecordMin = minByCondition.get(k); ApplicationOutRecordMin applicationOutRecordMin = minByCondition.get(k);
Integer mid = applicationOutRecordMin.getMid(); Integer mid = applicationOutRecordMin.getMid();
Material materialById = materialMapper.findMaterialById(mid); Material materialById = materialMapper.findMaterialById(mid);
if (materialById.getPrice() != null) {
sum += (materialById.getPrice() / 100) * applicationOutRecordMin.getQuantity(); sum += (materialById.getPrice() / 100) * applicationOutRecordMin.getQuantity();
} else {
sum += 0;
}
} }
} }
@ -3544,8 +3566,13 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
ApplicationOutRecordMin recordMin = applicationOutMinForComplete.get(i); ApplicationOutRecordMin recordMin = applicationOutMinForComplete.get(i);
Integer mid = recordMin.getMid(); Integer mid = recordMin.getMid();
Material materialById = materialMapper.findMaterialById(mid); Material materialById = materialMapper.findMaterialById(mid);
if (materialById.getPrice() != null) {
sum += (materialById.getPrice() / 100) * recordMin.getQuantity(); sum += (materialById.getPrice() / 100) * recordMin.getQuantity();
} }
else{
sum += 0;
}
}
} }
BigDecimal bg = new BigDecimal(sum); BigDecimal bg = new BigDecimal(sum);
sum = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); sum = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
@ -3958,7 +3985,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 获取当前出库物料 // 获取当前出库物料
Inventory materialById = materialMapper.findInventoryById(recordMin.getMid()); Inventory materialById = materialMapper.findInventoryById(recordMin.getMid());
// 计算当前出库金额 // 计算当前出库金额
double price_out = materialById.getPrice() * recordMin.getQuantity(); double price_out = 0.0;
if (materialById.getPrice() != null) {
price_out = materialById.getPrice() * recordMin.getQuantity();
}
BigDecimal bg = new BigDecimal(price_out / 100); BigDecimal bg = new BigDecimal(price_out / 100);
price_out = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); price_out = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
price += price_out; price += price_out;

27
src/main/java/com/dreamchaser/depository_manage/service/impl/ExcelServiceImpl.java

@ -244,7 +244,7 @@ public class ExcelServiceImpl implements ExcelService {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("mname",mname); map.put("mname",mname);
map.put("version",version); map.put("version",version);
List<MaterialP> materialPByCondition = materialService.findMaterialPByCondition(map); List<Material> materialPByCondition = materialService.findMaterialPByConditionForTable(map);
if(materialPByCondition.size() == 0){ if(materialPByCondition.size() == 0){
// 如果没有当前物料 // 如果没有当前物料
String s = dataIndex.get(i); String s = dataIndex.get(i);
@ -313,31 +313,6 @@ public class ExcelServiceImpl implements ExcelService {
insert.put("tempPlaceCode", excelInfoByInventory.getDepositoryCode()); insert.put("tempPlaceCode", excelInfoByInventory.getDepositoryCode());
insert.put("quantity", String.valueOf(ObjectFormatUtil.toInteger(excelInfoByInventory.getQuantity()))); insert.put("quantity", String.valueOf(ObjectFormatUtil.toInteger(excelInfoByInventory.getQuantity())));
if(excelInfoByInventory.getPrice() != null && "".equals(excelInfoByInventory.getPrice())) {
// 如果模板中总金额未填写
if (excelInfoByInventory.getAmounts() == null || "".equals(excelInfoByInventory.getAmounts())) {
// 求均值
// 总金额
Double amounts = Double.parseDouble(excelInfoByInventory.getPrice()) * 100 * Double.parseDouble(excelInfoByInventory.getQuantity());
insert.put("amounts", amounts);
// 保留两位
Double avgPrice = Double.parseDouble(excelInfoByInventory.getQuantity());
BigDecimal bg = new BigDecimal(avgPrice);
avgPrice = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
insert.put("price", String.valueOf(avgPrice));
} else {
// 求均值
insert.put("amounts", Double.parseDouble(excelInfoByInventory.getAmounts()) * 100);
Double avgPrice = (Double.parseDouble(excelInfoByInventory.getAmounts()) * 100) / ((Double.parseDouble(excelInfoByInventory.getQuantity())));
// 保留两位
BigDecimal bg = new BigDecimal(avgPrice);
avgPrice = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
insert.put("price", String.valueOf(avgPrice));
}
}else{
insert.put("price",0);
insert.put("amounts",0);
}
insert.put("depositoryId", depositoryId); insert.put("depositoryId", depositoryId);
insert.put("depositoryCode", excelInfoByInventory.getDepositoryCode()); insert.put("depositoryCode", excelInfoByInventory.getDepositoryCode());
insert.put("mid", material.getId()); insert.put("mid", material.getId());

161
src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java

@ -149,10 +149,6 @@ public class MaterialServiceImpl implements MaterialService {
public Integer updateMaterial(Map<String, Object> map) { public Integer updateMaterial(Map<String, Object> map) {
if (map.containsKey("price")) { if (map.containsKey("price")) {
Double price = Double.parseDouble((String) map.get("price")) * 100; Double price = Double.parseDouble((String) map.get("price")) * 100;
Integer quantity = Integer.parseInt((String) map.get("quantity"));
if (!map.containsKey("amounts")) {
map.put("amounts", price * quantity);
}
map.put("price", price); map.put("price", price);
} }
// 判断是否有保质期 // 判断是否有保质期
@ -218,8 +214,13 @@ public class MaterialServiceImpl implements MaterialService {
map.put("state", state); map.put("state", state);
List<Material> list = materialMapper.findMaterialByCondition(map); List<Material> list = materialMapper.findMaterialByCondition(map);
for (Material material : list) { for (Material material : list) {
if(material.getPrice() != null){
material.setPrice(material.getPrice() / 100); material.setPrice(material.getPrice() / 100);
material.setAmounts(material.getAmounts() / 100); }else{
material.setPrice(0.0);
}
material.setAmounts(material.getPrice() * material.getQuantity());
// 获取当前物料所处仓库 // 获取当前物料所处仓库
Integer depositoryId = material.getDepositoryId(); Integer depositoryId = material.getDepositoryId();
// 获取当前物料所处库位 // 获取当前物料所处库位
@ -245,6 +246,7 @@ public class MaterialServiceImpl implements MaterialService {
/** /**
* 根据条件查询符合条件的物料信息用于表格展示 * 根据条件查询符合条件的物料信息用于表格展示
*
* @param map 条件map * @param map 条件map
* @return 符合条件的物料信息 * @return 符合条件的物料信息
*/ */
@ -302,8 +304,13 @@ public class MaterialServiceImpl implements MaterialService {
map.put("state", state); map.put("state", state);
List<Inventory> list = materialMapper.findInventory(map); List<Inventory> list = materialMapper.findInventory(map);
for (Inventory inventory : list) { for (Inventory inventory : list) {
if (inventory.getPrice() != null) {
inventory.setPrice(inventory.getPrice() / 100); inventory.setPrice(inventory.getPrice() / 100);
inventory.setAmounts(inventory.getAmounts() / 100); } else {
inventory.setPrice(0.0);
}
inventory.setAmounts(inventory.getPrice() * inventory.getQuantity());
// 获取当前物料所处仓库 // 获取当前物料所处仓库
Integer depositoryId = inventory.getDepositoryId(); Integer depositoryId = inventory.getDepositoryId();
// 获取当前物料所处库位 // 获取当前物料所处库位
@ -325,6 +332,7 @@ public class MaterialServiceImpl implements MaterialService {
/** /**
* 根据物料编码及所处仓库查询库存 * 根据物料编码及所处仓库查询库存
*
* @param map 待查询条件 * @param map 待查询条件
* @return * @return
*/ */
@ -357,13 +365,16 @@ public class MaterialServiceImpl implements MaterialService {
map.put("begin", (page - 1) * size); map.put("begin", (page - 1) * size);
} }
List<Material> list = materialMapper.findMaterialByCondition(map); List<Material> list = materialMapper.findMaterialByCondition(map);
for (int i = 0; i < list.size(); i++) { for (Material material : list) {
list.get(i).setPrice(list.get(i).getPrice() / 100); if(material.getPrice() == null){
list.get(i).setAmounts(list.get(i).getAmounts() / 100); material.setPrice(0.0);
}
material.setPrice(material.getPrice() / 100);
material.setAmounts(material.getPrice() * material.getQuantity());
// 获取当前物料所处仓库 // 获取当前物料所处仓库
Integer depositoryId = list.get(i).getDepositoryId(); Integer depositoryId = material.getDepositoryId();
// 获取当前物料所处库位 // 获取当前物料所处库位
Integer mid = list.get(i).getId(); Integer mid = material.getId();
List<PlaceP> placeByMidAndDid = placeService.findPlaceByMidAndDid(mid, depositoryId); List<PlaceP> placeByMidAndDid = placeService.findPlaceByMidAndDid(mid, depositoryId);
StringBuilder placeCode = new StringBuilder(); StringBuilder placeCode = new StringBuilder();
for (int j = 0; j < placeByMidAndDid.size(); j++) { for (int j = 0; j < placeByMidAndDid.size(); j++) {
@ -372,9 +383,9 @@ public class MaterialServiceImpl implements MaterialService {
if (depositoryId != null) { if (depositoryId != null) {
Depository depositoryRecordById = depositoryMapper.findDepositoryById(depositoryId); Depository depositoryRecordById = depositoryMapper.findDepositoryById(depositoryId);
String code = depositoryRecordById.getCode(); String code = depositoryRecordById.getCode();
list.get(i).setDepositoryCode(code); material.setDepositoryCode(code);
} }
list.get(i).setPlaceCode(placeCode.toString()); material.setPlaceCode(placeCode.toString());
} }
return packForMatieral(list); return packForMatieral(list);
} }
@ -422,9 +433,12 @@ public class MaterialServiceImpl implements MaterialService {
@Override @Override
public List<Material> findMaterialAll() { public List<Material> findMaterialAll() {
List<Material> materialList = materialMapper.findMaterialByCondition(new HashMap<String, Object>()); List<Material> materialList = materialMapper.findMaterialByCondition(new HashMap<String, Object>());
for (int i = 0; i < materialList.size(); i++) { for (Material material : materialList) {
materialList.get(i).setPrice(materialList.get(i).getPrice() / 100); if(material.getPrice() == null){
materialList.get(i).setAmounts(materialList.get(i).getAmounts() / 100); material.setPrice(0.0);
}
material.setPrice(material.getPrice() / 100);
material.setAmounts(material.getPrice() * material.getQuantity());
} }
return materialList; return materialList;
} }
@ -440,8 +454,13 @@ public class MaterialServiceImpl implements MaterialService {
Material material = materialMapper.findMaterialById(id); Material material = materialMapper.findMaterialById(id);
MaterialType materialTypeByOldId = materialTypeMapper.findMaterialTypeByOldId(material.getMaterialTypeId()); MaterialType materialTypeByOldId = materialTypeMapper.findMaterialTypeByOldId(material.getMaterialTypeId());
material.setTypeName(materialTypeByOldId.getTname()); material.setTypeName(materialTypeByOldId.getTname());
if(material.getPrice() != null){
material.setPrice(material.getPrice() / 100); material.setPrice(material.getPrice() / 100);
material.setAmounts(material.getAmounts() / 100); }else{
material.setPrice(0.0);
}
material.setAmounts(material.getPrice() * material.getQuantity());
return material; return material;
} }
@ -454,10 +473,13 @@ public class MaterialServiceImpl implements MaterialService {
@Override @Override
public Inventory findInventoryById(int id) { public Inventory findInventoryById(int id) {
Inventory material = materialMapper.findInventoryById(id); Inventory material = materialMapper.findInventoryById(id);
MaterialType materialTypeByOldId = materialTypeMapper.findMaterialTypeByOldId(material.getMaterialTypeId()); if (material.getPrice() != null) {
material.setTypeName(materialTypeByOldId.getTname());
material.setPrice(material.getPrice() / 100); material.setPrice(material.getPrice() / 100);
material.setAmounts(material.getAmounts() / 100); } else {
material.setPrice(0.0);
}
material.setAmounts(material.getPrice() * material.getQuantity());
return material; return material;
} }
@ -473,8 +495,13 @@ public class MaterialServiceImpl implements MaterialService {
for (Inventory inventory : inventoryByMid) { for (Inventory inventory : inventoryByMid) {
MaterialType materialTypeByOldId = materialTypeMapper.findMaterialTypeByOldId(inventory.getMaterialTypeId()); MaterialType materialTypeByOldId = materialTypeMapper.findMaterialTypeByOldId(inventory.getMaterialTypeId());
inventory.setTypeName(materialTypeByOldId.getTname()); inventory.setTypeName(materialTypeByOldId.getTname());
if(inventory.getPlaceCode() != null){
inventory.setPrice(inventory.getPrice() / 100); inventory.setPrice(inventory.getPrice() / 100);
inventory.setAmounts(inventory.getAmounts() / 100); }else{
inventory.setPrice(0.0);
}
inventory.setAmounts(inventory.getPrice() * inventory.getQuantity());
} }
return inventoryByMid; return inventoryByMid;
} }
@ -549,8 +576,13 @@ public class MaterialServiceImpl implements MaterialService {
@Override @Override
public Material findMaterialAndTypeById(int id) { public Material findMaterialAndTypeById(int id) {
Material material = materialMapper.findMaterialAndTypeById(id); Material material = materialMapper.findMaterialAndTypeById(id);
if (material.getPrice() != null) {
material.setPrice(material.getPrice() / 100); material.setPrice(material.getPrice() / 100);
material.setAmounts(material.getAmounts() / 100); } else {
material.setPrice(0.0);
}
material.setAmounts(material.getPrice() * material.getQuantity());
Long producedDate = material.getProducedDate(); Long producedDate = material.getProducedDate();
if (producedDate != null) { if (producedDate != null) {
material.setShowProducedDate(DateUtil.TimeStampToDateTimeForDay(producedDate)); material.setShowProducedDate(DateUtil.TimeStampToDateTimeForDay(producedDate));
@ -582,10 +614,15 @@ public class MaterialServiceImpl implements MaterialService {
@Override @Override
public List<Inventory> findMaterialByIds(List<Integer> ids) { public List<Inventory> findMaterialByIds(List<Integer> ids) {
List<Inventory> materialList = materialMapper.findInventoryByIds(ids); List<Inventory> materialList = materialMapper.findInventoryByIds(ids);
for (int i = 0; i < materialList.size(); i++) { for (Inventory material : materialList) {
Inventory material = materialList.get(i); if(material.getPrice() != null){
materialList.get(i).setPrice(material.getPrice() / 100);
materialList.get(i).setAmounts(material.getAmounts() / 100); material.setPrice(material.getPrice() / 100);
}else{
material.setPrice(0.0);
}
material.setAmounts(material.getPrice() * material.getQuantity());
} }
return materialList; return materialList;
} }
@ -648,7 +685,10 @@ public class MaterialServiceImpl implements MaterialService {
Double sum = 0.0; Double sum = 0.0;
List<Inventory> materialAll = materialMapper.findInventory(new HashMap<String, Object>()); List<Inventory> materialAll = materialMapper.findInventory(new HashMap<String, Object>());
for (int i = 0; i < materialAll.size(); i++) { for (int i = 0; i < materialAll.size(); i++) {
sum += materialAll.get(i).getAmounts() / 100; Inventory inventory = materialAll.get(i);
if (inventory.getPrice() != null) {
sum += inventory.getPrice() * inventory.getQuantity() / 100;
}
} }
BigDecimal bg = new BigDecimal(sum); BigDecimal bg = new BigDecimal(sum);
sum = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); sum = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
@ -774,6 +814,9 @@ public class MaterialServiceImpl implements MaterialService {
splitInventoryForUnit.put(splitInfo.getNewUnit(), saveQuantity); splitInventoryForUnit.put(splitInfo.getNewUnit(), saveQuantity);
} }
if(inventory.getPrice() == null){
inventory.setPrice(0.0);
}
BigDecimal bigDecimal = BigDecimal.valueOf(inventory.getPrice() / splitInfo.getQuantity()); BigDecimal bigDecimal = BigDecimal.valueOf(inventory.getPrice() / splitInfo.getQuantity());
double split_price = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); double split_price = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
amounts += split_price * saveQuantity; amounts += split_price * saveQuantity;
@ -861,18 +904,23 @@ public class MaterialServiceImpl implements MaterialService {
Integer depositoryId = ObjectFormatUtil.toInteger(map.get("depositoryId")); Integer depositoryId = ObjectFormatUtil.toInteger(map.get("depositoryId"));
Depository depositoryRecordById = depositoryMapper.findDepositoryById(depositoryId); Depository depositoryRecordById = depositoryMapper.findDepositoryById(depositoryId);
List<Inventory> materialByDepository = materialMapper.findMaterialByDepository(map); List<Inventory> materialByDepository = materialMapper.findMaterialByDepository(map);
for (int i = 0; i < materialByDepository.size(); i++) { for (Inventory inventory : materialByDepository) {
materialByDepository.get(i).setDepositoryCode(depositoryRecordById.getCode()); inventory.setDepositoryCode(depositoryRecordById.getCode());
// 获取当前物料所处库位 // 获取当前物料所处库位
Integer mid = materialByDepository.get(i).getId(); Integer mid = inventory.getId();
List<PlaceP> placeByMidAndDid = placeService.findPlaceByMidAndDid(mid, depositoryId); List<PlaceP> placeByMidAndDid = placeService.findPlaceByMidAndDid(mid, depositoryId);
StringBuilder placeCode = new StringBuilder(); StringBuilder placeCode = new StringBuilder();
for (int j = 0; j < placeByMidAndDid.size(); j++) { for (int j = 0; j < placeByMidAndDid.size(); j++) {
placeCode.append(placeByMidAndDid.get(j).getCode()).append(" "); placeCode.append(placeByMidAndDid.get(j).getCode()).append(" ");
} }
materialByDepository.get(i).setPlaceCode(placeCode.toString()); inventory.setPlaceCode(placeCode.toString());
materialByDepository.get(i).setAmounts(materialByDepository.get(i).getAmounts() / 100); if (inventory.getPrice() != null) {
materialByDepository.get(i).setPrice(materialByDepository.get(i).getPrice() / 100);
inventory.setPrice(inventory.getPrice() / 100);
} else {
inventory.setPrice(0.0);
}
inventory.setAmounts(inventory.getPrice() * inventory.getQuantity());
} }
return pack(materialByDepository); return pack(materialByDepository);
@ -893,12 +941,6 @@ public class MaterialServiceImpl implements MaterialService {
public Integer insertInventoryForImport(Map<String, Object> map) { public Integer insertInventoryForImport(Map<String, Object> map) {
if (map.containsKey("quantity")) { if (map.containsKey("quantity")) {
int quantity = (int) Math.round(Double.parseDouble(map.get("quantity").toString())); int quantity = (int) Math.round(Double.parseDouble(map.get("quantity").toString()));
int price = 0;
if (map.containsKey("price")) {
price = (int) (Double.parseDouble(map.get("price").toString()));
}
map.put("price", price);
map.put("amounts", quantity * price);
} }
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
// params.put("code", map.get("code")); // params.put("code", map.get("code"));
@ -913,17 +955,8 @@ public class MaterialServiceImpl implements MaterialService {
// 如果该物料存在 // 如果该物料存在
Inventory material = inventory.get(0); Inventory material = inventory.get(0);
Double price = 0.0;
if (map.containsKey("price")) {
price = (Double.parseDouble(map.get("price").toString())) / 100;
}
int quantity = (int) Math.round(Double.parseDouble(map.get("quantity").toString())); int quantity = (int) Math.round(Double.parseDouble(map.get("quantity").toString()));
// 获取当前入库金额
Double amounts = (quantity * price * 100);
// 获取平均价格
Double avgPrice = (material.getAmounts() + amounts) / (material.getQuantity() + quantity);
material.setPrice(avgPrice);
material.setAmounts(material.getAmounts() + amounts);
material.setQuantity(material.getQuantity() + quantity); material.setQuantity(material.getQuantity() + quantity);
// 获取当前物料要存入的库位 // 获取当前物料要存入的库位
@ -1056,6 +1089,9 @@ public class MaterialServiceImpl implements MaterialService {
if (materialAndBarCode.getIid() != null) { if (materialAndBarCode.getIid() != null) {
Inventory inventoryByMid = materialMapper.findInventoryById(materialAndBarCode.getIid()); Inventory inventoryByMid = materialMapper.findInventoryById(materialAndBarCode.getIid());
if (inventoryByMid != null) { if (inventoryByMid != null) {
if(inventoryByMid.getPrice() == null){
inventoryByMid.setPrice(0.0);
}
materialAndBarCode.setPrice(inventoryByMid.getPrice() / 100); materialAndBarCode.setPrice(inventoryByMid.getPrice() / 100);
} else { } else {
materialAndBarCode.setPrice(0.0); materialAndBarCode.setPrice(0.0);
@ -1476,8 +1512,7 @@ public class MaterialServiceImpl implements MaterialService {
// 修改转移前的记录 // 修改转移前的记录
splitUnitMapper.updateSplitInventory(splitInventoryForBefore); splitUnitMapper.updateSplitInventory(splitInventoryForBefore);
} } else {
else{
// 如果不存在 // 如果不存在
// 获取当前单位对应的进制 // 获取当前单位对应的进制
@ -1496,6 +1531,9 @@ public class MaterialServiceImpl implements MaterialService {
Map<String, Object> insertForSplitInventory = new HashMap<>(); Map<String, Object> insertForSplitInventory = new HashMap<>();
insertForSplitInventory.put("mid", inventoryByMid.getMid()); insertForSplitInventory.put("mid", inventoryByMid.getMid());
insertForSplitInventory.put("mcode", inventoryByMid.getCode()); insertForSplitInventory.put("mcode", inventoryByMid.getCode());
if(inventoryByMid.getPrice() == null){
inventoryByMid.setPrice(0.0);
}
insertForSplitInventory.put("price", inventoryByMid.getPrice() / scale); insertForSplitInventory.put("price", inventoryByMid.getPrice() / scale);
insertForSplitInventory.put("quantity", num * scale - quantity); insertForSplitInventory.put("quantity", num * scale - quantity);
insertForSplitInventory.put("unit", unit); insertForSplitInventory.put("unit", unit);
@ -1511,6 +1549,9 @@ public class MaterialServiceImpl implements MaterialService {
// 定义进制时算法需要的参数 // 定义进制时算法需要的参数
Map<String, Object> paramForNewMap = new HashMap<>(); Map<String, Object> paramForNewMap = new HashMap<>();
paramForNewMap.put("mid", inventoryByMid.getMid()); paramForNewMap.put("mid", inventoryByMid.getMid());
if(inventoryByMid.getPrice() == null){
inventoryByMid.setPrice(0.0);
}
paramForNewMap.put("price", String.valueOf(inventoryByMid.getPrice() / 100)); paramForNewMap.put("price", String.valueOf(inventoryByMid.getPrice() / 100));
paramForNewMap.put("unit", unit); paramForNewMap.put("unit", unit);
paramForNewMap.put("depositoryId", map.get("depositoryId")); paramForNewMap.put("depositoryId", map.get("depositoryId"));
@ -1547,6 +1588,9 @@ public class MaterialServiceImpl implements MaterialService {
SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId()); SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId());
splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, dispose, pidAndMidForAfter.getId(), paramForNewMap, quantity, splitInfo); splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, dispose, pidAndMidForAfter.getId(), paramForNewMap, quantity, splitInfo);
} else { } else {
if(inventoryByMid.getPrice() == null){
inventoryByMid.setPrice(0.0);
}
paramForNewMap.put("price", Double.toString(inventoryByMid.getPrice() / 100)); paramForNewMap.put("price", Double.toString(inventoryByMid.getPrice() / 100));
paramForNewMap.put("realQuantity", String.valueOf(dispose)); paramForNewMap.put("realQuantity", String.valueOf(dispose));
paramForNewMap.put("quantity", String.valueOf(dispose)); paramForNewMap.put("quantity", String.valueOf(dispose));
@ -1566,8 +1610,7 @@ public class MaterialServiceImpl implements MaterialService {
// 修改库存数量 // 修改库存数量
splitUnitMapper.updateSplitInventory(splitInventoryForAfter); splitUnitMapper.updateSplitInventory(splitInventoryForAfter);
} }
} } else {
else {
// 如果不存在转移后的拆单库存记录 // 如果不存在转移后的拆单库存记录
// 定义用于添加拆单库存记录 // 定义用于添加拆单库存记录
@ -1592,6 +1635,9 @@ public class MaterialServiceImpl implements MaterialService {
SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId()); SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId());
splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, dispose, pidAndMidForAfter.getId(), paramForNewMap, quantity, splitInfo); splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, dispose, pidAndMidForAfter.getId(), paramForNewMap, quantity, splitInfo);
} else { } else {
if(inventoryByMid.getPrice() == null){
inventoryByMid.setPrice(0.0);
}
paramForNewMap.put("price", Double.toString(inventoryByMid.getPrice() / 100)); paramForNewMap.put("price", Double.toString(inventoryByMid.getPrice() / 100));
paramForNewMap.put("realQuantity", String.valueOf(dispose)); paramForNewMap.put("realQuantity", String.valueOf(dispose));
paramForNewMap.put("quantity", String.valueOf(dispose)); paramForNewMap.put("quantity", String.valueOf(dispose));
@ -1638,6 +1684,9 @@ public class MaterialServiceImpl implements MaterialService {
SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId()); SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId());
splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, dispose, ObjectFormatUtil.toInteger(insertForSplitInventory.get("id")), paramForNewMap, quantity, splitInfo); splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, dispose, ObjectFormatUtil.toInteger(insertForSplitInventory.get("id")), paramForNewMap, quantity, splitInfo);
} else { } else {
if(inventoryByMid.getPrice() == null){
inventoryByMid.setPrice(0.0);
}
paramForNewMap.put("price", Double.toString(inventoryByMid.getPrice() / 100)); paramForNewMap.put("price", Double.toString(inventoryByMid.getPrice() / 100));
paramForNewMap.put("realQuantity", String.valueOf(dispose)); paramForNewMap.put("realQuantity", String.valueOf(dispose));
paramForNewMap.put("quantity", String.valueOf(dispose)); paramForNewMap.put("quantity", String.valueOf(dispose));
@ -2905,12 +2954,10 @@ public class MaterialServiceImpl implements MaterialService {
if ("1".equals(type)) { if ("1".equals(type)) {
// 如果是入库 // 如果是入库
materialByTypeIds = materialMapper.findMaterialByTypeIdsAndMname(paramForMnameAndMtid); materialByTypeIds = materialMapper.findMaterialByTypeIdsAndMname(paramForMnameAndMtid);
} } else if ("2".equals(type)) {
else if ("2".equals(type)) {
// 如果是出库 // 如果是出库
inventoryByTypeIdsAndMname = materialMapper.findInventoryByTypeIdsAndMname(paramForMnameAndMtid); inventoryByTypeIdsAndMname = materialMapper.findInventoryByTypeIdsAndMname(paramForMnameAndMtid);
} } else if ("3".equals(type)) {
else if ("3".equals(type)) {
// 如果是盘点 // 如果是盘点
List<Inventory> inventoryList = materialMapper.findInventoryByTypeIdsAndMname(paramForMnameAndMtid); List<Inventory> inventoryList = materialMapper.findInventoryByTypeIdsAndMname(paramForMnameAndMtid);

2
src/main/resources/static/js/JcPrinter/index_Demo.js

@ -566,7 +566,7 @@ var app = new Vue({
}, },
downLoadServer(){ downLoadServer(){
window.open("/download/download","_self"); window.open("/download/zipDownload","_self");
}, },
/** /**
* 开始打印任务 * 开始打印任务

62
src/main/resources/templates/pages/application/application-in.html

@ -125,15 +125,6 @@
autocomplete="off" class="layui-input"> autocomplete="off" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">物料单价:</label>
<div class="layui-input-block">
<input name="price" type="number" placeholder="请填写入物料单价"
value=""
id="price"
class="layui-input" lay-verify="number">
</div>
</div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">物料数量:</label> <label class="layui-form-label">物料数量:</label>
<div class="layui-input-block"> <div class="layui-input-block">
@ -608,13 +599,6 @@
onclick="selectDate(this)" autocomplete="off" class="layui-input"> onclick="selectDate(this)" autocomplete="off" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">物料单价:</label>
<div class="layui-input-block">
<input name=` + "price" + NewIdNumber + ` type="number" placeholder="请填写入物料单价" id=` + "price" + NewIdNumber + `
class="layui-input" lay-verify="number" >
</div>
</div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">物料数量:</label> <label class="layui-form-label">物料数量:</label>
<div class="layui-input-block"> <div class="layui-input-block">
@ -659,7 +643,7 @@
// 获取当前高度 // 获取当前高度
var height = parseInt(($("#stepForm").css('height')).split("px")[0]); var height = parseInt(($("#stepForm").css('height')).split("px")[0]);
params.push(NewIdNumber); params.push(NewIdNumber);
$("#stepForm").css("height", height + 558 + 'px'); $("#stepForm").css("height", height + 520 + 'px');
$("#" + parentId).after(materialItem); $("#" + parentId).after(materialItem);
}; };
// 实现卡片删除 // 实现卡片删除
@ -671,7 +655,7 @@
// 获取祖父节点 // 获取祖父节点
var reparent = parent.parentNode; var reparent = parent.parentNode;
var height = parseInt(($("#stepForm").css('height')).split("px")[0]); var height = parseInt(($("#stepForm").css('height')).split("px")[0]);
$("#stepForm").css("height", height - 558 + 'px'); $("#stepForm").css("height", height - 520 + 'px');
params = remove(params, parentId); params = remove(params, parentId);
reparent.removeChild(parent); reparent.removeChild(parent);
}; };
@ -710,9 +694,6 @@
var materialItem = materialChildren.childNodes[3].childNodes[1].childNodes; var materialItem = materialChildren.childNodes[3].childNodes[1].childNodes;
var materialName = materialItem[1]; var materialName = materialItem[1];
var materialId = materialName.parentNode.parentNode.childNodes[3]; var materialId = materialName.parentNode.parentNode.childNodes[3];
// 单价条目
var priceItem = priceChildren.childNodes[3].childNodes;
var priceValue = priceItem[1];
// 条形码条码 // 条形码条码
var barCodeItem = barCodeChildren.childNodes[3]; var barCodeItem = barCodeChildren.childNodes[3];
var req = {}; var req = {};
@ -731,7 +712,6 @@
layer.msg("没有该编码,请确认是否输入正确"); layer.msg("没有该编码,请确认是否输入正确");
materialName.value = ""; materialName.value = "";
materialId.value = ""; materialId.value = "";
priceValue.value = "";
obj.value = ""; obj.value = "";
$("#barCode" + idNumber).empty(); $("#barCode" + idNumber).empty();
$("#unit" + idNumber).empty(); $("#unit" + idNumber).empty();
@ -740,7 +720,6 @@
} else { } else {
materialName.value = d.mname; materialName.value = d.mname;
materialId.value = d.mid; materialId.value = d.mid;
priceValue.value = d.price;
// 获取物料与条形码的对应关系 // 获取物料与条形码的对应关系
var materialAndBarCodeList = d["materialAndBarCodeList"]; var materialAndBarCodeList = d["materialAndBarCodeList"];
var barCode = $("#barCode" + idNumber); var barCode = $("#barCode" + idNumber);
@ -804,9 +783,6 @@
var materialName = materialItem[1]; var materialName = materialItem[1];
var materialId = materialName.parentNode.parentNode.childNodes[3]; var materialId = materialName.parentNode.parentNode.childNodes[3];
var mname = materialName.value; var mname = materialName.value;
// 单价条目
var priceItem = priceChildren.childNodes[3].childNodes;
var priceValue = priceItem[1];
// 条形码条码 // 条形码条码
var barCodeItem = barCodeChildren.childNodes[3]; var barCodeItem = barCodeChildren.childNodes[3];
mname = mname.split(",")[0]; mname = mname.split(",")[0];
@ -843,7 +819,6 @@
code = ""; code = "";
} }
codeValue.value = code; codeValue.value = code;
priceValue.value = material.price;
var materialAndBarCodeList = material["materialAndBarCodeList"]; var materialAndBarCodeList = material["materialAndBarCodeList"];
var barCodeInput = barCodeItem.childNodes[1].childNodes[1]; var barCodeInput = barCodeItem.childNodes[1].childNodes[1];
var barCodeImg = barCodeItem.childNodes[1].childNodes[3]; var barCodeImg = barCodeItem.childNodes[1].childNodes[3];
@ -994,9 +969,6 @@
var materialName = materialItem[1]; var materialName = materialItem[1];
var materialId = materialName.parentNode.parentNode.childNodes[3]; var materialId = materialName.parentNode.parentNode.childNodes[3];
var mname = materialName.value; var mname = materialName.value;
// 单价条目
var priceItem = priceChildren.childNodes[3].childNodes;
var priceValue = priceItem[1];
// 条形码条码 // 条形码条码
var barCodeItem = barCodeChildren.childNodes[3]; var barCodeItem = barCodeChildren.childNodes[3];
if (data === null) { if (data === null) {
@ -1014,7 +986,6 @@
materialName.value = data.mname; materialName.value = data.mname;
materialId.value = data.mid; materialId.value = data.mid;
codeValue.value = code; codeValue.value = code;
priceValue.value = data.price;
var materialAndBarCodeList = data["materialAndBarCodeList"]; var materialAndBarCodeList = data["materialAndBarCodeList"];
var idNumber = materialId.name.split("mid")[1]; var idNumber = materialId.name.split("mid")[1];
if (materialAndBarCodeList.length > 0) { if (materialAndBarCodeList.length > 0) {
@ -1113,9 +1084,6 @@
var materialItem = materialChildren.childNodes[3].childNodes[1].childNodes; var materialItem = materialChildren.childNodes[3].childNodes[1].childNodes;
var materialName = materialItem[1]; var materialName = materialItem[1];
var materialId = materialName.parentNode.parentNode.childNodes[3]; var materialId = materialName.parentNode.parentNode.childNodes[3];
// 单价条目
var priceItem = priceChildren.childNodes[3].childNodes;
var priceValue = priceItem[1];
// 条形码条码 // 条形码条码
var code = material.mcode; var code = material.mcode;
if (code === undefined) { if (code === undefined) {
@ -1124,7 +1092,6 @@
materialName.value = material.mname; materialName.value = material.mname;
materialId.value = material.mid; materialId.value = material.mid;
codeValue.value = code; codeValue.value = code;
priceValue.value = material.price;
barCodeInput.value = result; barCodeInput.value = result;
var idNumber = materialId.name.split("mid")[1]; var idNumber = materialId.name.split("mid")[1];
var shelfLife = material.shelfLife; var shelfLife = material.shelfLife;
@ -1781,31 +1748,6 @@
}; };
form.on('select()', function (data) {
let elem = data.elem; //得到select原始DOM对象
let elemId = elem.id;
if (elemId.indexOf("unit") === 0) {
// 如果进行选择的是计量单位
let id = elemId.split("unit")[1];
let mid = $("#mid" + id).val();
let unit = data.value;
let req = {};
req.newUnit = unit;
req.mid = mid;
$.ajax({
url: "/split/calcPriceForSplit",
data: JSON.stringify(req),
dataType: "json",
type: "post",
contentType: "application/json;charset=utf-8",
success: function (res) {
let data = res.data;
$("#price" + id).val(data);
}
});
}
});
}) })
</script> </script>
</body> </body>

31
src/main/resources/templates/pages/application/application-in_back.html

@ -68,13 +68,6 @@
autocomplete="off" class="layui-input" > autocomplete="off" class="layui-input" >
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">物料单价:</label>
<div class="layui-input-block">
<input name="price" type="number" placeholder="请填写入物料单价" th:value="${materialById.getPrice()}"
class="layui-input" lay-verify="number">
</div>
</div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">物料数量:</label> <label class="layui-form-label">物料数量:</label>
<div class="layui-input-block"> <div class="layui-input-block">
@ -346,30 +339,6 @@
step.next('#stepForm'); step.next('#stepForm');
}); });
form.on('select()', function (data) {
let elem = data.elem; //得到select原始DOM对象
let elemId = elem.id;
if(elemId.indexOf("unit") === 0){
// 如果进行选择的是计量单位
let id = elemId.split("unit")[1];
let mid = $("#mid"+id).val();
let unit = data.value;
let req = {};
req.newUnit = unit;
req.mid = mid;
$.ajax({
url:"/split/calcPriceForSplit",
data:JSON.stringify(req),
dataType:"json",
type:"post",
contentType: "application/json;charset=utf-8",
success:function (res) {
let data = res.data;
$("#price"+id).val(data);
}
});
}
});
}) })
</script> </script>

38
src/main/resources/templates/pages/application/application-in_scanQrCode.html

@ -298,13 +298,6 @@
</div> </div>
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">物料单价:</label>
<div class="layui-input-block">
<input name=` + "price" + NewIdNumber + ` type="number" placeholder="请填写入物料单价" value="${obj.price}"
class="layui-input" lay-verify="number">
</div>
</div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">物料数量:</label> <label class="layui-form-label">物料数量:</label>
<div class="layui-input-block"> <div class="layui-input-block">
@ -338,7 +331,7 @@
if (NewIdNumber !== "") { if (NewIdNumber !== "") {
params.push(NewIdNumber) params.push(NewIdNumber)
} }
$("#stepForm").css("height", height + 495 + 'px'); $("#stepForm").css("height", height + 460 + 'px');
var materialItem = firstItem + depositoryItem + lastItem; // 最终 var materialItem = firstItem + depositoryItem + lastItem; // 最终
$("#btn_sub").prepend(materialItem) $("#btn_sub").prepend(materialItem)
}; };
@ -535,13 +528,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">物料单价:</label>
<div class="layui-input-block">
<input name=` + "price" + NewIdNumber + ` type="number" placeholder="请填写入物料单价" value=""
class="layui-input" lay-verify="number">
</div>
</div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">物料数量:</label> <label class="layui-form-label">物料数量:</label>
<div class="layui-input-block"> <div class="layui-input-block">
@ -572,7 +559,7 @@
// 获取当前高度 // 获取当前高度
var height = parseInt(($("#stepForm").css('height')).split("px")[0]); var height = parseInt(($("#stepForm").css('height')).split("px")[0]);
params.push(NewIdNumber); params.push(NewIdNumber);
$("#stepForm").css("height", height + 555 + 'px'); $("#stepForm").css("height", height + 520 + 'px');
var materialItem = firstItem + depositoryItem + lastItem; var materialItem = firstItem + depositoryItem + lastItem;
$("#" + parentId).after(materialItem); $("#" + parentId).after(materialItem);
}; };
@ -586,7 +573,7 @@
// 获取祖父节点 // 获取祖父节点
var reparent = parent.parentNode; var reparent = parent.parentNode;
var height = parseInt(($("#stepForm").css('height')).split("px")[0]); var height = parseInt(($("#stepForm").css('height')).split("px")[0]);
$("#stepForm").css("height", height - 555 + 'px'); $("#stepForm").css("height", height - 520 + 'px');
params = remove(params, parentId); params = remove(params, parentId);
reparent.removeChild(parent); reparent.removeChild(parent);
}; };
@ -618,9 +605,6 @@
var materialItem = materialChildren.childNodes[3].childNodes[1].childNodes; var materialItem = materialChildren.childNodes[3].childNodes[1].childNodes;
var materialName = materialItem[1]; var materialName = materialItem[1];
var materialId = materialName.parentNode.parentNode.childNodes[3]; var materialId = materialName.parentNode.parentNode.childNodes[3];
// 单价条目
var priceItem = priceChildren.childNodes[3].childNodes;
var priceValue = priceItem[1];
// 条形码条码 // 条形码条码
var barCodeItem = barCodeChildren.childNodes[3]; var barCodeItem = barCodeChildren.childNodes[3];
@ -640,14 +624,12 @@
layer.msg("没有该编码,请确认是否输入正确"); layer.msg("没有该编码,请确认是否输入正确");
materialName.value = ""; materialName.value = "";
materialId.value = ""; materialId.value = "";
priceValue.value = "";
obj.value = ""; obj.value = "";
$("#barCode" + idNumber).remove(); $("#barCode" + idNumber).remove();
form.render(); form.render();
} else { } else {
materialName.value = d.mname; materialName.value = d.mname;
materialId.value = d.id; materialId.value = d.id;
priceValue.value = d.price;
// 获取物料与条形码的对应关系 // 获取物料与条形码的对应关系
var materialAndBarCodeList = d["materialAndBarCodeList"]; var materialAndBarCodeList = d["materialAndBarCodeList"];
var splitInfoList = d["splitInfoList"]; var splitInfoList = d["splitInfoList"];
@ -703,9 +685,6 @@
var materialItem = materialChildren.childNodes[3].childNodes[1].childNodes; var materialItem = materialChildren.childNodes[3].childNodes[1].childNodes;
var materialName = materialItem[1]; var materialName = materialItem[1];
var materialId = materialName.parentNode.parentNode.childNodes[3]; var materialId = materialName.parentNode.parentNode.childNodes[3];
// 单价条目
var priceItem = priceChildren.childNodes[3].childNodes;
var priceValue = priceItem[1];
var mname = materialName.value; var mname = materialName.value;
mname = mname.split(",")[0]; mname = mname.split(",")[0];
// 条形码条码 // 条形码条码
@ -746,7 +725,6 @@
code = ""; code = "";
} }
codeValue.value = code; codeValue.value = code;
priceValue.value = material.price;
var materialAndBarCodeList = material["materialAndBarCodeList"]; var materialAndBarCodeList = material["materialAndBarCodeList"];
var barCodeInput = barCodeItem.childNodes[1].childNodes[1]; var barCodeInput = barCodeItem.childNodes[1].childNodes[1];
var barCodeImg = barCodeItem.childNodes[1].childNodes[3]; var barCodeImg = barCodeItem.childNodes[1].childNodes[3];
@ -885,9 +863,6 @@
var materialItem = materialChildren.childNodes[3].childNodes[1].childNodes; var materialItem = materialChildren.childNodes[3].childNodes[1].childNodes;
var materialName = materialItem[1]; var materialName = materialItem[1];
var materialId = materialName.parentNode.parentNode.childNodes[3]; var materialId = materialName.parentNode.parentNode.childNodes[3];
// 单价条目
var priceItem = priceChildren.childNodes[3].childNodes;
var priceValue = priceItem[1];
// 条形码 // 条形码
var barCodeChildren = parent.childNodes[9]; var barCodeChildren = parent.childNodes[9];
var barCodeItem = barCodeChildren.childNodes[3]; var barCodeItem = barCodeChildren.childNodes[3];
@ -902,7 +877,6 @@
materialName.value = material.mname; materialName.value = material.mname;
materialId.value = material.mid; materialId.value = material.mid;
codeValue.value = code; codeValue.value = code;
priceValue.value = material.price;
barCodeInput.value = result; barCodeInput.value = result;
var idNumber = materialId.name.split("mid")[1]; var idNumber = materialId.name.split("mid")[1];
var shelfLife = material.shelfLife; var shelfLife = material.shelfLife;
@ -1000,9 +974,6 @@
var materialName = materialItem[1]; var materialName = materialItem[1];
var materialId = materialName.parentNode.parentNode.childNodes[3]; var materialId = materialName.parentNode.parentNode.childNodes[3];
var mname = materialName.value; var mname = materialName.value;
// 单价条目
var priceItem = priceChildren.childNodes[3].childNodes;
var priceValue = priceItem[1];
// 条形码条码 // 条形码条码
var barCodeItem = barCodeChildren.childNodes[3]; var barCodeItem = barCodeChildren.childNodes[3];
if (data === null) { if (data === null) {
@ -1021,7 +992,6 @@
materialName.value = data.mname; materialName.value = data.mname;
materialId.value = data.id; materialId.value = data.id;
codeValue.value = code; codeValue.value = code;
priceValue.value = data.price;
var materialAndBarCodeList = data["materialAndBarCodeList"]; var materialAndBarCodeList = data["materialAndBarCodeList"];
var idNumber = materialId.name.split("mid")[1]; var idNumber = materialId.name.split("mid")[1];
if (materialAndBarCodeList.length > 0) { if (materialAndBarCodeList.length > 0) {

1
src/main/resources/templates/pages/application/application_multi.html

@ -96,7 +96,6 @@
{field: 'depositoryName', width: 150, title: '仓库名称'}, {field: 'depositoryName', width: 150, title: '仓库名称'},
{title: '计量单位', width: 200, templet: '#changeUnit', align: "center"}, {title: '计量单位', width: 200, templet: '#changeUnit', align: "center"},
{field: 'quantity', width: 150, title: '数量',edit:'quantity'}, {field: 'quantity', width: 150, title: '数量',edit:'quantity'},
{field: 'price', width: 150, title: '单价',edit:'price'},
{field: 'applyRemark', width: 150, title: '备注说明',edit:'applyRemark'}, {field: 'applyRemark', width: 150, title: '备注说明',edit:'applyRemark'},
{title: '操作', minWidth: 250, toolbar: '#currentTableBar', align: "center"} {title: '操作', minWidth: 250, toolbar: '#currentTableBar', align: "center"}
] ]

5
src/main/resources/templates/pages/depository/table-stock.html

@ -459,7 +459,7 @@
done: function (res) { done: function (res) {
layer.closeAll('loading'); //关闭loading layer.closeAll('loading'); //关闭loading
//如果上传成功 //如果上传成功
if (res.code == 200) { if (res.code === 200) {
var re = ""; var re = "";
for (let i = 0; i < res.data.errMsg.length; i++) { for (let i = 0; i < res.data.errMsg.length; i++) {
var show = "<p style='color: #ff211e'>" + res.data.errMsg[i] + ":错误" + "</p>"; var show = "<p style='color: #ff211e'>" + res.data.errMsg[i] + ":错误" + "</p>";
@ -469,9 +469,8 @@
var code = res.data.dataList[i]["code"] === null ? '' : res.data.dataList[i]["code"]; var code = res.data.dataList[i]["code"] === null ? '' : res.data.dataList[i]["code"];
var mname = res.data.dataList[i]["mname"]; var mname = res.data.dataList[i]["mname"];
var version = res.data.dataList[i]["version"] === null ? '' : res.data.dataList[i]["version"]; var version = res.data.dataList[i]["version"] === null ? '' : res.data.dataList[i]["version"];
var price = res.data.dataList[i]["price"];
var quantity = res.data.dataList[i]["quantity"]; var quantity = res.data.dataList[i]["quantity"];
var show = "<p style='color: #00FF00'>" + code + ", " + mname + ", " + version + ", 单价为" + price + ", 数量为" + quantity + ":成功" + "</p>"; var show = "<p style='color: #00FF00'>" + code + ", " + mname + ", " + version + ", 数量为" + quantity + ":成功" + "</p>";
re += show re += show
} }

7
src/main/resources/templates/pages/material/material-view.html

@ -100,6 +100,13 @@
class="layui-input"> class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">单价</label>
<div class="layui-input-inline">
<input type="text" th:value="${record.getPrice()}" name="price" required autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label" style="height: 40px;">保质期:</label> <label class="layui-form-label" style="height: 40px;">保质期:</label>
<div class="layui-input-inline"> <div class="layui-input-inline">

Loading…
Cancel
Save