Commit 57df3182 authored by lujunye's avatar lujunye

入库默认仓库,库位,出库逻辑补充

parent 46d4fe31
...@@ -356,7 +356,7 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne ...@@ -356,7 +356,7 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne
let data = rkSelectArr[indexPath.row] let data = rkSelectArr[indexPath.row]
cell.nameLbl.text = data.goods_name cell.nameLbl.text = data.goods_name
cell.detailLbl.text = data.spec_str! + " " + \(data.price!)" cell.detailLbl.text = data.spec_str! + " " + \(data.price!)"
cell.rkPriceTf.text = "" cell.rkPriceTf.text = "\(data.price!)"
cell.rkCountTf.text = "" cell.rkCountTf.text = ""
cell.bzqTf.text = "" cell.bzqTf.text = ""
cell.timeLbl.text = "请选择生产日期" cell.timeLbl.text = "请选择生产日期"
......
...@@ -35,6 +35,10 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo ...@@ -35,6 +35,10 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo
HUD.flash(.label("请选择出库类型"), delay: 1.2) HUD.flash(.label("请选择出库类型"), delay: 1.2)
return return
} }
if rkSelectArr.count == 0 {
HUD.flash(.label("请选择出库商品"), delay: 1.2)
return
}
if isGm == false { if isGm == false {
rkSelectArr.forEach { (model) in rkSelectArr.forEach { (model) in
if model.chuKuLiang == nil { if model.chuKuLiang == nil {
...@@ -42,6 +46,13 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo ...@@ -42,6 +46,13 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo
return return
} }
} }
}else{
for i in 0 ..< rkSelectArr.count {
if piCiArr![i].count == 0 {
HUD.flash(.label("请选择商品批次"), delay: 1.2)
return
}
}
} }
let alterView = GeliAlertTextView(frame: self.view.window!.bounds) let alterView = GeliAlertTextView(frame: self.view.window!.bounds)
......
...@@ -430,14 +430,35 @@ class CRKListVC: BaseViewController,UITableViewDelegate,UITableViewDataSource,CR ...@@ -430,14 +430,35 @@ class CRKListVC: BaseViewController,UITableViewDelegate,UITableViewDataSource,CR
let model = datas![indexPath.row] let model = datas![indexPath.row]
let vc = CRKXiangQVC() let vc = CRKXiangQVC()
vc.delegate = self vc.delegate = self
vc.status = model.status
vc.model = model
if model.io_type == 1 && auth.contains("122"){//入库 if model.io_type == 1 && auth.contains("122"){//入库
vc.isGm = true vc.isGm = true
let UserToken = UserDefaults.standard.value(forKey: "user_token")
InputInitInfo(["user_token":UserToken as Any,"goods_id":model.goods_res?.first?.goods_id as Any], success: { (data) in
let model = data as! InputInitInfoModel
model.data?.warehouse_res?.forEach({ (item) in
if item.is_default == 1 {
vc.w_id = item.w_id
vc.w_name = item.w_name
item.warehouse_position?.forEach({ (poi) in
if poi.is_default == 1 {
vc.p_id = poi.p_id
vc.p_name = poi.p_name
}
})
}
})
self.navigationController?.pushViewController(vc, animated: true)
}) { (error) in
}
return
} }
if model.io_type == 2 && auth.contains("121"){ if model.io_type == 2 && auth.contains("121"){
vc.isGm = true vc.isGm = true
} }
vc.status = model.status
vc.model = model
self.navigationController?.pushViewController(vc, animated: true) self.navigationController?.pushViewController(vc, animated: true)
} }
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
......
...@@ -11,20 +11,23 @@ protocol CRKXiangQVCDelegate { ...@@ -11,20 +11,23 @@ protocol CRKXiangQVCDelegate {
func CRKXiangQVCFinishAction() func CRKXiangQVCFinishAction()
} }
class CRKXiangQVC: BaseViewController,UITableViewDelegate,UITableViewDataSource,NewCKCellDelegate,PiCiXuanZeViewControllerDelegate,WarehoseMangementListVCDelegate,GLAlertSelectViewDelegate,GeliAlertTextViewDelegate,GeliAlertViewDelegate{ class CRKXiangQVC: BaseViewController,UITableViewDelegate,UITableViewDataSource,NewCKCellDelegate,PiCiXuanZeViewControllerDelegate,WarehoseMangementListVCDelegate,GLAlertSelectViewDelegate,GeliAlertTextViewDelegate,GeliAlertViewDelegate{
var w_id:Int?
var p_id:Int?
var w_name:String?
var p_name:String?
func sureGeliAlertViewAction(sender: UIButton) { func sureGeliAlertViewAction(sender: UIButton) {
let UserToken = UserDefaults.standard.value(forKey: "user_token") let UserToken = UserDefaults.standard.value(forKey: "user_token")
//MARK: - 出入库列表 iog_id //MARK: - 出入库列表 iog_id
let poi = positionArr![selectIdx!]
var goodInfoArr:Array<Any> = [] var goodInfoArr:Array<Any> = []
inGoodsModels?.forEach({ (item) in inGoodsModels?.forEach({ (item) in
let goods = [ let goods = [
"w_id":poi.w_id as Any, "w_id":w_id as Any,
"p_id":poi.p_id as Any, "p_id":p_id as Any,
"iog_id":item.iog_id as Any "iog_id":item.iog_id as Any
] ]
goodInfoArr.append(goods) goodInfoArr.append(goods)
...@@ -60,10 +63,12 @@ class CRKXiangQVC: BaseViewController,UITableViewDelegate,UITableViewDataSource, ...@@ -60,10 +63,12 @@ class CRKXiangQVC: BaseViewController,UITableViewDelegate,UITableViewDataSource,
wareHouseModel = sender wareHouseModel = sender
holderArr?.insert(sender.w_name!, at: 0) holderArr?.insert(sender.w_name!, at: 0)
holderArr?.remove(at: 1) holderArr?.remove(at: 1)
holderArr?.insert("请选择库位", at: 1)
holderArr?.remove(at: 2)
w_id = sender.w_id
positionArr?.removeAll() positionArr?.removeAll()
kuWeiArr.forEach { (item) in kuWeiArr.forEach { (item) in
positionArr?.append(item) positionArr?.append(item)
print(item.p_name)
} }
listView.reloadData() listView.reloadData()
} }
...@@ -180,6 +185,13 @@ class CRKXiangQVC: BaseViewController,UITableViewDelegate,UITableViewDataSource, ...@@ -180,6 +185,13 @@ class CRKXiangQVC: BaseViewController,UITableViewDelegate,UITableViewDataSource,
if model?.io_type == 1 { if model?.io_type == 1 {
titleArr = ["仓库","库位","入库类型"] titleArr = ["仓库","库位","入库类型"]
holderArr = ["请选择仓库","请选择库位",str] holderArr = ["请选择仓库","请选择库位",str]
if w_name != nil {
holderArr = [w_name!,"请选择库位",str]
}
if p_name != nil {
holderArr = [w_name!,p_name!,str]
}
navbar.title = "商品入库详情" navbar.title = "商品入库详情"
...@@ -187,7 +199,6 @@ class CRKXiangQVC: BaseViewController,UITableViewDelegate,UITableViewDataSource, ...@@ -187,7 +199,6 @@ class CRKXiangQVC: BaseViewController,UITableViewDelegate,UITableViewDataSource,
let model = data as! InGoodsDetailModel let model = data as! InGoodsDetailModel
model.data?.goods_res?.forEach({ (item) in model.data?.goods_res?.forEach({ (item) in
self.inGoodsModels?.append(item) self.inGoodsModels?.append(item)
}) })
if self.isGm == false { if self.isGm == false {
self.titleArr = ["入库类型","备注"] self.titleArr = ["入库类型","备注"]
...@@ -380,9 +391,41 @@ class CRKXiangQVC: BaseViewController,UITableViewDelegate,UITableViewDataSource, ...@@ -380,9 +391,41 @@ class CRKXiangQVC: BaseViewController,UITableViewDelegate,UITableViewDataSource,
self.view.addSubview(view) self.view.addSubview(view)
glSelectView = view glSelectView = view
} }
}else{
if w_id != nil {
let UserToken = UserDefaults.standard.value(forKey: "user_token")
WarehouseDetail(["user_token":UserToken as Any,"w_id":w_id as Any], success: { (data) in
let mo = data as! ShopWarehouseDetailModel
mo.data?.position_res?.forEach({ (item) in
self.positionArr!.append(item)
})
if self.glSelectView == nil {
let view = GLAlertSelectView(frame: self.view.bounds)
if self.selectIdx != nil {
view.selectNum = self.selectIdx
view.tempNum = view.selectNum
}
view.isOnlySelectKuWei = true
view.delegate = self
view.titleLbl.text = "请选择库位"
var poiArr:Array<String> = []
for item in self.positionArr! {
let str = item.p_name! + "(库存数:\(item.inventory_count!)"
poiArr.append(str)
}
view.dataArr = poiArr
self.view.addSubview(view)
self.glSelectView = view
}
}) { (error) in
}
}else{ }else{
HUD.flash(.label("请选择仓库"), delay: 1.2) HUD.flash(.label("请选择仓库"), delay: 1.2)
} }
}
} }
} }
...@@ -581,6 +624,7 @@ class CRKXiangQVC: BaseViewController,UITableViewDelegate,UITableViewDataSource, ...@@ -581,6 +624,7 @@ class CRKXiangQVC: BaseViewController,UITableViewDelegate,UITableViewDataSource,
let data = positionArr![selectIdx!] let data = positionArr![selectIdx!]
holderArr?.insert(data.p_name!, at: 1) holderArr?.insert(data.p_name!, at: 1)
holderArr?.remove(at: 2) holderArr?.remove(at: 2)
p_id = data.p_id
glSelectView?.removeFromSuperview() glSelectView?.removeFromSuperview()
glSelectView = nil glSelectView = nil
listView.reloadData() listView.reloadData()
......
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 to comment