Commit f0f769aa by 肖洋洋
parents 8dab0a00 69db51ad
......@@ -128,6 +128,7 @@ public class PurRequisitionController {
**/
@RequestMapping(path = "/add", method = RequestMethod.POST)
public Result add(@RequestBody PurRequisitionPage purRequisitionPage,
@RequestParam(value = "token")String token,
@RequestParam(value = "headerStatus", required = false) String headerStatus) {
//判断想要下推生成采购申请单的状态是否为已审批
if (!"approval".equals(headerStatus) && !"completed".equals(headerStatus)) {
......@@ -164,10 +165,12 @@ public class PurRequisitionController {
}
requisitionLine.setItemCode(invItem.getItemCode());
}
SysAccessToken sysAccessToken = userServer.checkAccessToken(token);
PurRequisition purRequisition = new PurRequisition();
BeanUtils.copyProperties(purRequisitionPage, purRequisition);
//为采购申请主表添加组织code
purRequisition.setSysOrgCode(sysOrgCode);
purRequisition.setApplicant(sysAccessToken.getUserId());
//添加
purRequisitionService.saveMain(purRequisition, purRequisitionPage.getPurRequisitionLineList());
return new Result(true,StatusCode.OK,"下推采购申请成功!",purRequisitionPage.getOrderNumber());
......
package orthopedics.controller.bookcity;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import javafx.scene.effect.SepiaTone;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import orthopedics.controller.error.ErrorEnum;
import orthopedics.model.*;
import orthopedics.service.*;
import orthopedics.util.Result;
import orthopedics.util.StatusCode;
import orthopedics.util.UuidUtil;
import sun.security.x509.AttributeNameEnumeration;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/bookcity/stockTransfer")
public class StockTransferController {
@Autowired
private UserServer userServer;
@Autowired
private PropertiesServer propertiesServer;
@Autowired
private HrPersonOrgService hrPersonOrgService;
@Autowired
private OrganzitionServer organzitionServer;
@Autowired
private PurRequisitionService purRequisitionService;
@Autowired
private PurOrderHeaderService purOrderHeaderService;
@Autowired
private RcvReceiptHeaderService rcvReceiptHeaderService;
@Autowired
private TransferService transferService;
@Autowired
private InventoryServer inventoryServer;
@Autowired
private TransactionServer transactionServer;
/*
*描述:库存现有量的转单功能,请配request、采购purchase、调拨transfer、退货return
*参数:json
*创建者:ice
**/
@RequestMapping(value = "/transferData",method = RequestMethod.POST)
public Result transferData(@RequestBody JSONObject jsonObject){
String token = jsonObject.getString("token");
//检查accesstoken的有效性
SysAccessToken sysAccessToken = userServer.checkAccessToken(token);
//查询用户
SysUser sysUser = userServer.getSysUserById(sysAccessToken.getUserId());
String type = jsonObject.getString("type");
JSONArray data = jsonObject.getJSONArray("data");
if(data.size() == 0){
return new Result(false,StatusCode.ERROR,"转单失败,没有选中的数据");
}
JSONArray array = new JSONArray();
for(int i=0;i<data.size();i++){
JSONObject json = data.getJSONObject(i);
String invId = json.getString("inv_id");
String subinvId = json.getString("subinv_id");
String locatorId = json.getString("locator_id");
String itemId = json.getString("item_id");
List<InvTransaction> transactionList = transactionServer.selectInvTrasactionByItemId(invId,subinvId,locatorId,itemId);
if(transactionList.size() == 0){
throw ErrorEnum.Error.createException("转单失败,选中的数据不存在!");
}
InvItem invItem = getInvItem(itemId);
json.put("item_code",invItem.getItemCode());
json.put("item_name",invItem.getItemName());
json.put("unit_code",invItem.getPrimaryUnit());
json.put("purchase_price",invItem.getPurchasePrice());
array.add(json);
}
List<String> orderNumber = new ArrayList<>();
switch (type){
case "request":orderNumber = getPurRequisiton(sysUser,array);break;
case "purchase":orderNumber = getPurOrder(sysUser,array);break;
case "transfer":orderNumber = getWarTransfer(sysUser,array);break;
case "return":orderNumber = getRcvReceipt(sysUser,array);break;
default:return new Result(false,StatusCode.ERROR,"转单类型不存在");
}
return new Result(true,StatusCode.OK,"转换成功",orderNumber);
}
//请配转换成采购申请单
private List<String> getPurRequisiton(SysUser sysUser, JSONArray jsonArray){
List<String> list = new ArrayList<>();
String orderNumber = propertiesServer.generateFlowingWater("REQUISITION_NUMBER");
LocalDateTime time = LocalDateTime.now();
Map<String,String> map = getOrgInfo(sysUser.getPersonId());
PurRequisition purRequisition = new PurRequisition();
purRequisition.setId(UuidUtil.get32UUIDString());
purRequisition.setOrderType("000000006c60dba1016c60f588e00002");
purRequisition.setOrderNumber(orderNumber);
purRequisition.setOrderStatus("new");
purRequisition.setCreateBy(sysUser.getUsername());
purRequisition.setCreateTime(time);
purRequisition.setUpdateBy(sysUser.getRealname());
purRequisition.setUpdateTime(time);
purRequisition.setPriority("0");
purRequisition.setRequiredDate(time);
purRequisition.setOrgId(map.get("org_id"));
purRequisition.setApplicant(sysUser.getId());
purRequisition.setSysOrgCode(map.get("sys_org_code"));
List<PurRequisitionLine> purRequisitionLineList = new ArrayList<>();
for(int i=0;i<jsonArray.size();i++){
JSONObject jsonObject = jsonArray.getJSONObject(i);
String quantity = jsonObject.getString("quantity");
String price = jsonObject.getString("purchase_price");
PurRequisitionLine purRequisitionLine = new PurRequisitionLine();
purRequisitionLine.setId(UuidUtil.get32UUIDString());
purRequisitionLine.setLineNumber(String.valueOf(i+1));
purRequisitionLine.setPurchasePrice(price);
purRequisitionLine.setItemId(jsonObject.getString("item_id"));
purRequisitionLine.setItemCode(jsonObject.getString("item_code"));
purRequisitionLine.setItemName(jsonObject.getString("item_name"));
purRequisitionLine.setUnitCode(jsonObject.getString("unit_code"));
purRequisitionLine.setQuantity(quantity);
purRequisitionLine.setDiscount("0");
purRequisitionLine.setFixedPrice(price);
purRequisitionLine.setRealPrice(String.valueOf(Double.valueOf(quantity)*Double.valueOf(price)));
purRequisitionLineList.add(purRequisitionLine);
}
purRequisitionService.saveMain(purRequisition,purRequisitionLineList);
list.add(orderNumber);
return list;
}
//采购转换成采购订单
private List<String> getPurOrder(SysUser sysUser, JSONArray jsonArray){
List<String> list = new ArrayList<>();
String orderNumber = propertiesServer.generateFlowingWater("PUR_ORDER");
LocalDateTime time = LocalDateTime.now();
Map<String,String> map = getOrgInfo(sysUser.getPersonId());
String username = sysUser.getUsername();
PurOrderHeader purOrderHeader = new PurOrderHeader();
purOrderHeader.setId(UuidUtil.get32UUIDString());
purOrderHeader.setCreateBy(username);
purOrderHeader.setCreateTime(time);
purOrderHeader.setUpdateBy(username);
purOrderHeader.setUpdateTime(time);
purOrderHeader.setOrgId(map.get("org_id"));
purOrderHeader.setOrderType("000000006c60dba1016c60f61f7a0003");
purOrderHeader.setOrderNumber(orderNumber);
purOrderHeader.setOrderDate(String.valueOf(time));
purOrderHeader.setHeaderStatus("new");
purOrderHeader.setSysOrgCode(map.get("sys_org_code"));
purOrderHeader.setOrderCurrency("");
purOrderHeader.setSupplierId("");
purOrderHeader.setBuyerId("");
purOrderHeader.setSourceHeaderId("");
purOrderHeader.setSourceHeaderNumber("");
List<PurOrderLine> purOrderLineList = new ArrayList<>();
for(int i=0;i<jsonArray.size();i++){
JSONObject jsonObject = jsonArray.getJSONObject(i);
String quantity = jsonObject.getString("quantity");
String price = jsonObject.getString("purchase_price");
PurOrderLine purOrderLine = new PurOrderLine();
purOrderLine.setId(UuidUtil.get32UUIDString());
purOrderLine.setLineNumber(String.valueOf(i+1));
purOrderLine.setPurchasePrice(price);
purOrderLine.setItemId(jsonObject.getString("item_id"));
purOrderLine.setItemCode(jsonObject.getString("item_code"));
purOrderLine.setItemName(jsonObject.getString("item_name"));
purOrderLine.setUnitCode(jsonObject.getString("unit_code"));
purOrderLine.setQuantity(quantity);
purOrderLine.setQuantity(quantity);
purOrderLine.setDiscount("0");
purOrderLine.setFixedPrice(price);
purOrderLine.setRequiredDate(time);
purOrderLine.setRealPrice(String.valueOf(Double.valueOf(quantity)*Double.valueOf(price)));
purOrderLine.setAttribute1(jsonObject.getString("balance"));
purOrderLineList.add(purOrderLine);
}
purOrderHeaderService.saveMain(purOrderHeader,purOrderLineList);
list.add(orderNumber);
return list;
}
//调拨转换成调拨单
private List<String> getWarTransfer(SysUser sysUser, JSONArray jsonArray){
List<String> orderNumList = new ArrayList<>();
LocalDateTime time = LocalDateTime.now();
Map<String,String> map = getOrgInfo(sysUser.getPersonId());
String username = sysUser.getUsername();
judgeInvId(jsonArray);
JSONArray jsonArr = getJSONArray(jsonArray);
//根据调入库存不同进行分组
List<JSONArrayModel> list = jsonArr.toJavaList(JSONArrayModel.class);
Map<String,List<JSONArrayModel>> jsonMap = list.stream().collect(Collectors.groupingBy(JSONArrayModel::getIn_inv_id));
Set set = jsonMap.entrySet();
for(Iterator iterator = set.iterator();iterator.hasNext();){
String orderNumber = propertiesServer.generateFlowingWater("WAR_TRANSFER_NUMBER");
Map.Entry entry = (Map.Entry) iterator.next();
List<JSONArrayModel> jsonObjectList = (List<JSONArrayModel>) entry.getValue();
Inventory inventory = getInventory(jsonObjectList.get(0).getIn_inv_id());
WarTransfer warTransfer = new WarTransfer();
warTransfer.setId(UuidUtil.get32UUIDString());
warTransfer.setInvCode(jsonObjectList.get(0).getInv_code());
warTransfer.setInvName(jsonObjectList.get(0).getInv_id());
warTransfer.setInSubinvCode("");
warTransfer.setSubinvCode(jsonObjectList.get(0).getSubinv_code());
warTransfer.setInInvCode(inventory.getInvCode());
warTransfer.setInInvName(inventory.getId());
warTransfer.setCreateBy(username);
warTransfer.setCreateTime(time);
warTransfer.setUpdateBy(username);
warTransfer.setUpdateTime(time);
warTransfer.setOrgId(map.get("sys_org_code"));
warTransfer.setSysOrgCode(map.get("sys_org_code"));
warTransfer.setOrderNumber(orderNumber);
warTransfer.setOrderStatus("new");
if(jsonObjectList.get(0).getInv_id().equals(jsonObjectList.get(0).getIn_inv_id())){
warTransfer.setOrderType("SUBINVENTORY_TRANSFER");
}else{
warTransfer.setOrderType("OTHERINVENTORY_TRANSFER");
}
warTransfer.setDeliveryName("");
warTransfer.setRequestorId("");
List<WarTransferLine> warTransferLineList = new ArrayList<>();
for (int i = 0; i < jsonObjectList.size(); i++) {
JSONArrayModel jsonArrayModel = jsonObjectList.get(i);
WarTransferLine warTransferLine = new WarTransferLine();
warTransferLine.setId(UuidUtil.get32UUIDString());
warTransferLine.setLineNumber(String.valueOf(i+1));
warTransferLine.setSubinvCode(jsonArrayModel.getSubinv_code());
warTransferLine.setSubinvName(jsonArrayModel.getSubinv_name());
warTransferLine.setLocatorCode(jsonArrayModel.getLocator_code());
warTransferLine.setItemId(jsonArrayModel.getItem_id());
warTransferLine.setItemCode(jsonArrayModel.getItem_code());
warTransferLine.setItemName(jsonArrayModel.getItem_name());
warTransferLine.setUnitCode(jsonArrayModel.getUnit_code());
warTransferLine.setUnitPrice(jsonArrayModel.getPurchase_price());
warTransferLine.setQuantity(jsonArrayModel.getQuantity());
warTransferLine.setAttribute1(jsonArrayModel.getBalance());
warTransferLineList.add(warTransferLine);
}
transferService.saveMain(warTransfer,warTransferLineList);
orderNumList.add(orderNumber);
}
return orderNumList;
}
//退货转换成接收单
private List<String> getRcvReceipt(SysUser sysUser, JSONArray jsonArray){
List<String> list = new ArrayList<>();
String orderNumber = propertiesServer.generateFlowingWater("RCV_NUMBER");
judgeInvId(jsonArray);
LocalDateTime time = LocalDateTime.now();
Map<String,String> map = getOrgInfo(sysUser.getPersonId());
String username = sysUser.getUsername();
String invId = jsonArray.getJSONObject(0).getString("inv_id");
String subinvId = jsonArray.getJSONObject(0).getString("subinv_id");
String locatorId = jsonArray.getJSONObject(0).getString("locator_id");
RcvReceiptHeader rcvReceiptHeader = new RcvReceiptHeader();
rcvReceiptHeader.setId(UuidUtil.get32UUIDString());
rcvReceiptHeader.setInvId(invId);
rcvReceiptHeader.setCreateBy(username);
rcvReceiptHeader.setCreateTime(time);
rcvReceiptHeader.setUpdateBy(username);
rcvReceiptHeader.setUpdateTime(time);
rcvReceiptHeader.setSysOrgCode(map.get("sys_org_code"));
rcvReceiptHeader.setReceiptType("SALE_RETURN");
rcvReceiptHeader.setReceiptNumber(orderNumber);
rcvReceiptHeader.setReceiptDate(time);
rcvReceiptHeader.setShipper(sysUser.getPersonId());
rcvReceiptHeader.setHeaderStatus("RECEIVED");
rcvReceiptHeader.setSourceHeaderId("");
rcvReceiptHeader.setSourceHeaderNumber("");
rcvReceiptHeader.setPartyId("");
rcvReceiptHeader.setReceiver("");
List<RcvReceiptLine> rcvReceiptLineList = new ArrayList<>();
for(int i=0;i<jsonArray.size();i++){
JSONObject jsonObject = jsonArray.getJSONObject(i);
RcvReceiptLine rcvReceiptLine = new RcvReceiptLine();
rcvReceiptLine.setId(UuidUtil.get32UUIDString());
rcvReceiptLine.setLineNumber(String.valueOf(i+1));
rcvReceiptLine.setInvId(invId);
rcvReceiptLine.setSubinvId(subinvId);
rcvReceiptLine.setLocatorId(locatorId);
rcvReceiptLine.setItemId(jsonObject.getString("item_id"));
rcvReceiptLine.setAttribute1(jsonObject.getString("item_name"));
rcvReceiptLine.setAttribute2(jsonObject.getString("item_code"));
rcvReceiptLine.setUnitCode(jsonObject.getString("unit_code"));
rcvReceiptLine.setShippedQuantity(Integer.valueOf(jsonObject.getString("quantity")));
rcvReceiptLine.setLineStatus("RECEIVED");
rcvReceiptLineList.add(rcvReceiptLine);
}
rcvReceiptHeaderService.saveMain(rcvReceiptHeader,rcvReceiptLineList);
list.add(orderNumber);
return list;
}
//取得当前用户的组织
private Map<String,String> getOrgInfo(String personId){
Map<String,String> map = new HashMap<>();
HrPersonOrg hrPersonOrg = hrPersonOrgService.findByPersonId(personId);
if(hrPersonOrg == null) {
throw ErrorEnum.Error.createException("转单失败,当前用户所属的组织不存在!");
}else{
String orgId = hrPersonOrg.getOrgId();
map.put("org_id",orgId);
HrOrganization hrOrganization = organzitionServer.selectByOrgId(orgId);
String sysOrgCode = "";
if(hrOrganization != null){
sysOrgCode = hrOrganization.getOrgCode();
}
map.put("sys_org_code",sysOrgCode);
}
return map;
}
//找到商品信息
private InvItem getInvItem(String itemId){
InvItem invItem = inventoryServer.selectInvItemByItemId(itemId);
if(invItem == null){
throw ErrorEnum.Error.createException("转单失败,找不到对应的商品信息!");
}
return invItem;
}
//找到对应的库存
private Inventory getInventory(String invId){
Inventory inventory = inventoryServer.selectInventoryById(invId);
if(inventory == null){
throw ErrorEnum.Error.createException("转单失败,找不到对应的库存信息!");
}
return inventory;
}
//找到对应的库区
private InvSubinventory getInvSubinventory(String invId,String subinvId){
InvSubinventory invSubinventory = inventoryServer.selectSubInventoryBySubInvId(subinvId);
if(invSubinventory == null){
throw ErrorEnum.Error.createException("转单失败,找不到对应的库区信息!");
}
InvSubinventory subinventory = inventoryServer.selectSubInventoryBySubInvCode(invId,invSubinventory.getSubinvCode());
if(subinventory == null){
throw ErrorEnum.Error.createException("转单失败,库区信息检查不通过!");
}
return subinventory;
}
//找到对应的货架
public InvLocator getInvLocator(String invId,String subinvId,String locatorId){
InvLocator invLocator = inventoryServer.selectInvLocatorById(locatorId);
if(invLocator == null){
throw ErrorEnum.Error.createException("转单失败,找不到对应的货架信息!");
}
InvLocator locator = inventoryServer.selectInvLocatorByLocatorCode(invId,subinvId,invLocator.getLocatorCode());
if(locator == null){
throw ErrorEnum.Error.createException("转单失败,货架信息检查不通过!");
}
return locator;
}
//判断是否对同一库存进行操作
private void judgeInvId(JSONArray jsonArray){
int count = 1;
String invId = jsonArray.getJSONObject(0).getString("inv_id");
for(int i=1;i<jsonArray.size();i++){
JSONObject jsonObject = jsonArray.getJSONObject(i);
String another_invId = jsonObject.getString("inv_id");
if(invId.equals(another_invId)){
count++;
}
}
if(count != jsonArray.size()){
throw ErrorEnum.Error.createException("调拨或退货时请对同一库存进行操作!");
}
}
//获取库存库区货架信息
private JSONArray getJSONArray(JSONArray jsonArray) {
for(int i=0;i<jsonArray.size();i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
String invId = jsonObject.getString("inv_id");
String subinvId = jsonObject.getString("subinv_id");
String locatorId = jsonObject.getString("locator_id");
Inventory inventory = getInventory(invId);
jsonObject.put("inv_code", inventory.getInvCode());
jsonObject.put("inv_name", inventory.getInvName());
InvSubinventory subinventory = getInvSubinventory(invId, subinvId);
jsonObject.put("subinv_code", subinventory.getSubinvCode());
jsonObject.put("subinv_name", subinventory.getSubinvName());
InvLocator invLocator = getInvLocator(invId, subinvId, locatorId);
jsonObject.put("locator_code", invLocator.getLocatorCode());
jsonObject.put("locator_name", invLocator.getLocatorName());
}
return jsonArray;
}
}
......@@ -74,7 +74,7 @@ public class WshShipmentController {
}
String updateBy = user.getRealname();
LocalDateTime updateTime = LocalDateTime.now();
wshShipmentHeaderPage.setShipperV(user.getPersonId());
wshShipmentHeaderPage.setShipperV(user.getId());
//查找出当前用户所在的组织sysorgcode
Map<String,Object> map = getInfo(user.getPersonId());
//赋值当前用户的组织code
......
package orthopedics.model;
public class JSONArrayModel {
private String inv_id;
private String inv_code;
private String inv_name;
private String subinv_id;
private String subinv_code;
private String subinv_name;
private String locator_id;
private String locator_code;
private String locator_name;
private String item_id;
private String item_code;
private String item_name;
private String unit_code;
private String purchase_price;
private String in_inv_id;
private String in_inv_code;
private String in_inv_name;
private String balance;
private String quantity;
public String getInv_id() {
return inv_id;
}
public void setInv_id(String inv_id) {
this.inv_id = inv_id;
}
public String getInv_code() {
return inv_code;
}
public void setInv_code(String inv_code) {
this.inv_code = inv_code;
}
public String getInv_name() {
return inv_name;
}
public void setInv_name(String inv_name) {
this.inv_name = inv_name;
}
public String getSubinv_id() {
return subinv_id;
}
public void setSubinv_id(String subinv_id) {
this.subinv_id = subinv_id;
}
public String getSubinv_code() {
return subinv_code;
}
public void setSubinv_code(String subinv_code) {
this.subinv_code = subinv_code;
}
public String getSubinv_name() {
return subinv_name;
}
public void setSubinv_name(String subinv_name) {
this.subinv_name = subinv_name;
}
public String getLocator_id() {
return locator_id;
}
public void setLocator_id(String locator_id) {
this.locator_id = locator_id;
}
public String getLocator_code() {
return locator_code;
}
public void setLocator_code(String locator_code) {
this.locator_code = locator_code;
}
public String getLocator_name() {
return locator_name;
}
public void setLocator_name(String locator_name) {
this.locator_name = locator_name;
}
public String getItem_id() {
return item_id;
}
public void setItem_id(String item_id) {
this.item_id = item_id;
}
public String getItem_code() {
return item_code;
}
public void setItem_code(String item_code) {
this.item_code = item_code;
}
public String getItem_name() {
return item_name;
}
public void setItem_name(String item_name) {
this.item_name = item_name;
}
public String getUnit_code() {
return unit_code;
}
public void setUnit_code(String unit_code) {
this.unit_code = unit_code;
}
public String getPurchase_price() {
return purchase_price;
}
public void setPurchase_price(String purchase_price) {
this.purchase_price = purchase_price;
}
public String getIn_inv_id() {
return in_inv_id;
}
public void setIn_inv_id(String in_inv_id) {
this.in_inv_id = in_inv_id;
}
public String getIn_inv_code() {
return in_inv_code;
}
public void setIn_inv_code(String in_inv_code) {
this.in_inv_code = in_inv_code;
}
public String getIn_inv_name() {
return in_inv_name;
}
public void setIn_inv_name(String in_inv_name) {
this.in_inv_name = in_inv_name;
}
public String getBalance() {
return balance;
}
public void setBalance(String balance) {
this.balance = balance;
}
public String getQuantity() {
return quantity;
}
public void setQuantity(String quantity) {
this.quantity = quantity;
}
@Override
public String toString() {
return "JSONArrayModel{" +
"inv_id='" + inv_id + '\'' +
", inv_code='" + inv_code + '\'' +
", inv_name='" + inv_name + '\'' +
", subinv_id='" + subinv_id + '\'' +
", subinv_code='" + subinv_code + '\'' +
", subinv_name='" + subinv_name + '\'' +
", locator_id='" + locator_id + '\'' +
", locator_code='" + locator_code + '\'' +
", locator_name='" + locator_name + '\'' +
", item_id='" + item_id + '\'' +
", item_code='" + item_code + '\'' +
", item_name='" + item_name + '\'' +
", unit_code='" + unit_code + '\'' +
", purchase_price='" + purchase_price + '\'' +
", in_inv_id='" + in_inv_id + '\'' +
", in_inv_code='" + in_inv_code + '\'' +
", in_inv_name='" + in_inv_name + '\'' +
", balance='" + balance + '\'' +
", quantity='" + quantity + '\'' +
'}';
}
}
......@@ -35,7 +35,6 @@ public class PurOrderHeaderService {
entity.setCreateTime(purOrderHeader.getCreateTime());
entity.setUpdateBy(purOrderHeader.getUpdateBy());
entity.setUpdateTime(purOrderHeader.getUpdateTime());
entity.setOrderNumber(purOrderHeader.getOrderNumber());
entity.setSourceHeaderId(purOrderHeader.getSourceHeaderId());
entity.setSourceHeaderNumber(purOrderHeader.getSourceHeaderNumber());
purOrderLineMapper.insert(entity);
......
......@@ -3,6 +3,7 @@ package orthopedics.service;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import orthopedics.dao.InvItemOnhandMapper;
import orthopedics.dao.InvTransactionMapper;
......@@ -80,4 +81,22 @@ public class TransferService {
public int updateInvItemOnHandByOriginTxId(Integer quantity,String id){
return invItemOnhandMapper.updateInvItemOnHandByOriginTxId(quantity, id);
}
@Transactional
public void saveMain(WarTransfer warTransfer,List<WarTransferLine> warTransferLineList){
warTransferMapper.insert(warTransfer);
for (WarTransferLine warTransferLine : warTransferLineList) {
warTransferLine.setCreateBy(warTransfer.getCreateBy());
warTransferLine.setCreateTime(warTransfer.getCreateTime());
warTransferLine.setUpdateBy(warTransfer.getUpdateBy());
warTransferLine.setUpdateTime(warTransfer.getUpdateTime());
warTransferLine.setOrderNumber(warTransfer.getOrderNumber());
warTransferLine.setOrgId(warTransfer.getOrgId());
warTransferLine.setSysOrgCode(warTransfer.getSysOrgCode());
warTransferLine.setLineStatus(warTransfer.getOrderStatus());
warTransferLine.setOrderType(warTransfer.getOrderType());
warTransferLine.setSourceHeaderId(warTransfer.getId());
warTransferLineMapper.insert(warTransferLine);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment