Commit 106b2233 authored by lujunye's avatar lujunye

权限补充

parent 0015941c
......@@ -12,7 +12,7 @@ import ObjectMapper
class WarehouseIoListModel: Mappable {
var code:Int?
var message : String?
var data : Array<WarehouseIoListDataModel>?
var data : WarehouseIoListDataModel?
required init?( map: Map) {
......@@ -25,6 +25,20 @@ class WarehouseIoListModel: Mappable {
}
class WarehouseIoListDataModel: Mappable {
var io_res :Array<WarehouseIoListDataDetailModel>? //商品信息数据
var auth : Array<String>? //仓储权限,63入库 64出库 65申请入库 66申请出库 121出库审核 122入库审核
required init?( map: Map) {
}
func mapping(map: Map) {
io_res <- map["io_res"]
auth <- map["auth"]
}
}
class WarehouseIoListDataDetailModel: Mappable {
var io_id:Int?//出入库id
var oi_sn : String?//出入库sn
var applicant : String? //申请人
......@@ -32,7 +46,7 @@ class WarehouseIoListDataModel: Mappable {
var io_type:Int? //类型(出/入库),1入库,2出库,3撤销入库
var status : Int?//出入库(审核)状态,1审核中,2通过,3不通过
var auditor : String?//审核人
var add_time:Double?//下单时间
var audit_time : Double?//审核时间
var i_type : Int?
......@@ -40,9 +54,6 @@ class WarehouseIoListDataModel: Mappable {
var o_type:Int?
var goods_res : Array<WarehouseIoListDataResModel>? //商品信息
var io_type_cn : String? //出/入库详细类型(已中文处理
required init?( map: Map) {
}
......
......@@ -44,7 +44,7 @@ class NewSelectItemVc: BaseViewController,UITableViewDelegate,UITableViewDataSou
let cellData = rkDatas[indexPath.row]
cell.selectBtn.isSelected = false
for item in rkSelectArr {
if item.goods_id == cellData.goods_id {
if item.sku_id == cellData.sku_id {
cell.selectBtn.isSelected = true
}
}
......
......@@ -132,7 +132,7 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne
}
var sku_id:Int?
var goods_id:Int?
@IBOutlet weak var lgBtnTitLbl: UILabel!
@IBOutlet weak var lgBtn: LGButton!
......@@ -197,6 +197,9 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne
self.rkWareHouseArr.append(item)
})
model.data?.goods_info?.forEach({ (item) in
if item.sku_id == self.sku_id {
self.rkSelectArr.append(item)
}
self.rkDatas.append(item)
})
self.listView.reloadData()
......
......@@ -23,7 +23,7 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo
var isGm = false
var goods_id:Int?
var sku_id:Int?
var rkSelectArr:Array<InputInitInfoGoodsInfoModel> = []//产品选择
var rkDatas:Array<InputInitInfoGoodsInfoModel> = []//产品
......@@ -172,6 +172,9 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo
let model = data as! InputInitInfoModel
model.data?.goods_info?.forEach({ (item) in
if item.sku_id == self.sku_id {
self.rkSelectArr.append(item)
}
self.rkDatas.append(item)
self.piCiArr?.append([])
})
......
......@@ -136,7 +136,6 @@ class PiCiXuanZeViewController: BaseViewController,UITableViewDelegate,UITableVi
}
func PiCiXuanZeCellRefreshCount() {
totalCount = 0
for item in selectArr{
let data = dataArray[item]
if data.chuHuoLiang != nil {
......@@ -166,11 +165,12 @@ class PiCiXuanZeViewController: BaseViewController,UITableViewDelegate,UITableVi
totalCount = 0
for item in recordArr{
if item.chuHuoLiang != nil {
if item.chuHuoLiang != nil && item.chuHuoLiang != 0{
totalCount += item.chuHuoLiang!
}
}
listView.reloadData()
let index = IndexPath(row: 0, section: 1)
listView.reloadRows(at: [index], with: .none)
}
......
......@@ -179,7 +179,7 @@ class CRKListVC: BaseViewController,UITableViewDelegate,UITableViewDataSource,CR
@IBOutlet weak var searchBG: UIView!
var datas:Array<WarehouseIoListDataModel>? = []
var datas:Array<WarehouseIoListDataDetailModel>? = []
@IBOutlet weak var listView: UITableView!
@IBOutlet weak var searchBgView: UIView!
......@@ -227,7 +227,7 @@ class CRKListVC: BaseViewController,UITableViewDelegate,UITableViewDataSource,CR
var end_time = 0
var keyword = ""
var page = 0
var auth:Array<String> = []
@objc func loadData(){
page = 1
let UserToken = UserDefaults.standard.value(forKey: "user_token")
......@@ -236,8 +236,13 @@ class CRKListVC: BaseViewController,UITableViewDelegate,UITableViewDataSource,CR
WarehouseIoList(dic , success: { (data) in
self.datas?.removeAll()
let model = data as! WarehouseIoListModel
model.data?.forEach({ (item) in
model.data?.io_res!.forEach({ (item) in
self.datas?.append(item)
})
model.data?.auth?.forEach({ (item) in
self.auth.append(item)
})
self.listView.reloadData()
......@@ -250,7 +255,7 @@ class CRKListVC: BaseViewController,UITableViewDelegate,UITableViewDataSource,CR
})
}, completion: nil)
if model.data?.count == 0 {
if model.data?.io_res?.count == 0 {
self.listView?.mj_footer?.endRefreshingWithNoMoreData()
}else{
self.listView?.mj_footer?.endRefreshing()
......@@ -269,11 +274,11 @@ class CRKListVC: BaseViewController,UITableViewDelegate,UITableViewDataSource,CR
WarehouseIoList(dic, success: { (data) in
let dataM = data as! WarehouseIoListModel
if dataM.data?.count == 0 {
if dataM.data?.io_res?.count == 0 {
self.listView?.mj_footer?.endRefreshingWithNoMoreData()
}else{
self.page += 1
dataM.data?.forEach({ (model) in
dataM.data?.io_res?.forEach({ (model) in
self.datas?.append(model)
})
self.listView.reloadData()
......@@ -409,13 +414,18 @@ class CRKListVC: BaseViewController,UITableViewDelegate,UITableViewDataSource,CR
//MARK: - CELL DELEGATE
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
//MARK: - 跳转详情
//MARK: - 跳转详情 出入库
let model = datas![indexPath.row]
let vc = CRKXiangQVC()
vc.delegate = self
vc.isGm = isGm
vc.model = model
if model.io_type == 1 && auth.contains("122"){
vc.isGm = true
}
if model.io_type == 2 && auth.contains("121"){
vc.isGm = true
}
vc.status = model.status
vc.model = model
self.navigationController?.pushViewController(vc, animated: true)
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
......@@ -429,6 +439,13 @@ class CRKListVC: BaseViewController,UITableViewDelegate,UITableViewDataSource,CR
cell.isGm = isGm
let model = datas![indexPath.row]
cell.status = model.status
cell.isGm = false
if model.io_type == 1 && auth.contains("122"){
cell.isGm = true
}
if model.io_type == 2 && auth.contains("121"){
cell.isGm = true
}
cell.dataArr = model.goods_res
cell.delegate = self
cell.tag = indexPath.row
......
......@@ -10,7 +10,41 @@ import UIKit
protocol CRKXiangQVCDelegate {
func CRKXiangQVCFinishAction()
}
class CRKXiangQVC: BaseViewController,UITableViewDelegate,UITableViewDataSource,NewCKCellDelegate,PiCiXuanZeViewControllerDelegate,WarehoseMangementListVCDelegate,GLAlertSelectViewDelegate,GeliAlertTextViewDelegate{
class CRKXiangQVC: BaseViewController,UITableViewDelegate,UITableViewDataSource,NewCKCellDelegate,PiCiXuanZeViewControllerDelegate,WarehoseMangementListVCDelegate,GLAlertSelectViewDelegate,GeliAlertTextViewDelegate,GeliAlertViewDelegate{
func sureGeliAlertViewAction(sender: UIButton) {
let UserToken = UserDefaults.standard.value(forKey: "user_token")
//MARK: - 出入库列表 iog_id
let poi = positionArr![selectIdx!]
var goodInfoArr:Array<Any> = []
inGoodsModels?.forEach({ (item) in
let goods = [
"w_id":poi.w_id as Any,
"p_id":poi.p_id as Any,
"iog_id":item.iog_id as Any
]
goodInfoArr.append(goods)
})
let goodsInfo = dataChangeString(sender: goodInfoArr)
let dict = [
"user_token":UserToken as Any,
"io_id":model?.io_id as Any,
"goods_info":goodsInfo as Any
]
GoodsInputAudit(dict, success: { (data) in
self.delegate?.CRKXiangQVCFinishAction()
self.navigationController?.popViewController(animated: true)
}) { (error) in
}
}
......@@ -44,7 +78,7 @@ class CRKXiangQVC: BaseViewController,UITableViewDelegate,UITableViewDataSource,
var piCiArr:Array<Array<GetGoodBatchDataModel>> = []//批次
@IBOutlet weak var btmView: UIView!
@IBOutlet weak var listView: UITableView!
var model:WarehouseIoListDataModel?
var model:WarehouseIoListDataDetailModel?
@IBOutlet weak var btmViewH: NSLayoutConstraint!
var inGoodsModels:Array<InGoodsDetailDataGoodsResModel>? = []
......@@ -168,7 +202,6 @@ class CRKXiangQVC: BaseViewController,UITableViewDelegate,UITableViewDataSource,
//MARK: - 通过点击事件
@IBAction func crkxqBtnClick(_ sender: UIButton) {
if sender.tag == 0 {//通过
if model?.io_type == 1 {
let str = holderArr![0]
......@@ -182,36 +215,13 @@ class CRKXiangQVC: BaseViewController,UITableViewDelegate,UITableViewDataSource,
HUD.flash(.label("请选择库位"), delay: 1.2)
return
}
let UserToken = UserDefaults.standard.value(forKey: "user_token")
//MARK: - 出入库列表 iog_id
let poi = positionArr![selectIdx!]
var goodInfoArr:Array<Any> = []
inGoodsModels?.forEach({ (item) in
let goods = [
"w_id":poi.w_id as Any,
"p_id":poi.p_id as Any,
"iog_id":item.iog_id as Any
]
goodInfoArr.append(goods)
})
let goodsInfo = dataChangeString(sender: goodInfoArr)
let dict = [
"user_token":UserToken as Any,
"io_id":model?.io_id as Any,
"goods_info":goodsInfo as Any
]
GoodsInputAudit(dict, success: { (data) in
self.delegate?.CRKXiangQVCFinishAction()
self.navigationController?.popViewController(animated: true)
}) { (error) in
}
let alertView = GeliAlertView(frame: self.view.window!.bounds)
alertView.delegate = self;
alertView.tishiLbl.text = ""
alertView.titileLbl.text = "是否通过审核?"
alertView.rightBtn.setAttributedTitle(NSAttributedString(string: "保存"), for: .normal)
alertView.rightBtn.tag = 1001
self.view.window?.addSubview(alertView)
}else{
let alterView = GeliAlertTextView(frame: self.view.window!.bounds)
alterView.delegate = self
......@@ -239,52 +249,52 @@ class CRKXiangQVC: BaseViewController,UITableViewDelegate,UITableViewDataSource,
]
AuditFail(dict, success: { (data) in
self.delegate?.CRKXiangQVCFinishAction()
self.navigationController?.popViewController(animated: true)
self.navigationController?.popViewController(animated: true)
}) { (error) in
}
return
}
//出库通过
var batchInfo:Array<Any> = []
piCiArr.forEach { (batchArr) in
batchArr.forEach { (model) in
let batch = [
"w_id":model.w_id as Any,
"p_id":model.p_id as Any,
"number":model.chuHuoLiang as Any,
"production_data":model.production_data as Any,
"shelf_life":model.shelf_life as Any,
"valid_date":model.valid_date as Any,
"batch_id":model.batch_id as Any,
"report_id":model.report_id as Any
]
batchInfo.append(batch)
}
}
var goodsInfoArr : Array<Any> = []
outGoodsModels?.forEach({ (item) in
let goods = [
"goods_id":item.goods_id as Any,
"goods_name":item.goods_name as Any,
"goods_spec":item.goods_spec as Any,
"sku_id":item.sku_id as Any,
"number":item.number as Any,
"batch_info":batchInfo
] as [String : Any]
goodsInfoArr.append(goods)
})
let goods_info = dataChangeString(sender: goodsInfoArr)
let dict = [
"user_token":UserToken as Any,
"io_id":model?.io_id as Any,
"audit_remark":sender,
"goods_info":goods_info]
GoodsOutputAudit(dict, success: { (data) in
self.delegate?.CRKXiangQVCFinishAction()
self.navigationController?.popViewController(animated: true)
}) { (error) in
var batchInfo:Array<Any> = []
piCiArr.forEach { (batchArr) in
batchArr.forEach { (model) in
let batch = [
"w_id":model.w_id as Any,
"p_id":model.p_id as Any,
"number":model.chuHuoLiang as Any,
"production_data":model.production_data as Any,
"shelf_life":model.shelf_life as Any,
"valid_date":model.valid_date as Any,
"batch_id":model.batch_id as Any,
"report_id":model.report_id as Any
]
batchInfo.append(batch)
}
}
var goodsInfoArr : Array<Any> = []
outGoodsModels?.forEach({ (item) in
let goods = [
"goods_id":item.goods_id as Any,
"goods_name":item.goods_name as Any,
"goods_spec":item.goods_spec as Any,
"sku_id":item.sku_id as Any,
"number":item.number as Any,
"batch_info":batchInfo
] as [String : Any]
goodsInfoArr.append(goods)
})
let goods_info = dataChangeString(sender: goodsInfoArr)
let dict = [
"user_token":UserToken as Any,
"io_id":model?.io_id as Any,
"audit_remark":sender,
"goods_info":goods_info]
GoodsOutputAudit(dict, success: { (data) in
self.delegate?.CRKXiangQVCFinishAction()
self.navigationController?.popViewController(animated: true)
}) { (error) in
}
}else{
HUD.flash(.label("请填写备注"), delay: 1.2)
......@@ -358,9 +368,15 @@ class CRKXiangQVC: BaseViewController,UITableViewDelegate,UITableViewDataSource,
let cell = tableView.dequeueReusableCell(withIdentifier: "CRKBtnCell") as! CRKBtnCell
cell.nameLbl.text = titleArr![indexPath.row]
cell.contentLbl.text = holderArr![indexPath.row]
if cell.nameLbl.text != "仓库" && cell.nameLbl.text != "库位" {
if (model?.status)! > 1 {
setCellUI(cell: cell)
}else{
if cell.nameLbl.text != "仓库" && cell.nameLbl.text != "库位" {
setCellUI(cell: cell)
}
}
return cell
}
......@@ -506,6 +522,7 @@ class CRKXiangQVC: BaseViewController,UITableViewDelegate,UITableViewDataSource,
}
func setCellUI(cell:CRKBtnCell){
cell.mustLbl.isHidden = true
cell.arrowImg.isHidden = true
cell.contentLbl.textColor = UIColor(named: "标题字颜色")
......
......@@ -441,6 +441,7 @@ class GoodsManageListVC: BaseViewController, UICollectionViewDelegate, UICollect
vc.titleStrArr = [item.leftBtn.titleLabel!.text!,item.rightBtn.titleLabel!.text!]
let data = items[indexPath.row]
vc.goods_id = data.goods_id
vc.sku_id = data.sku_id
self.navigationController?.pushViewController(vc, animated: true)
}
......@@ -454,6 +455,7 @@ class GoodsManageListVC: BaseViewController, UICollectionViewDelegate, UICollect
vc.titleStrArr = [item.leftBtn.titleLabel!.text!,item.rightBtn.titleLabel!.text!]
let data = items[index]
vc.goods_id = data.goods_id
vc.sku_id = data.sku_id
self.navigationController?.pushViewController(vc, animated: true)
}
//MARK:-- cell delegate 上下架,入库
......@@ -498,6 +500,7 @@ class GoodsManageListVC: BaseViewController, UICollectionViewDelegate, UICollect
// return
// let vc = NewRKVc()
let vc = NewCKVc()
vc.sku_id = changeGoodsResModel?.sku_id
vc.goods_id = changeGoodsResModel?.goods_id
self.navigationController?.pushViewController(vc, animated: true)
// let vc = RuKuViewController()
......@@ -530,6 +533,7 @@ class GoodsManageListVC: BaseViewController, UICollectionViewDelegate, UICollect
print("入库哦哦")
// let vc = NewRKVc()
let vc = NewCKVc()
vc.sku_id = changeGoodsResModel?.sku_id
vc.goods_id = changeGoodsResModel?.goods_id
self.navigationController?.pushViewController(vc, animated: true)
// HUD.flash(.label("敬请期待"),delay: 1.2)
......
......@@ -30,6 +30,8 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo
var pinPai_id:Int? //品牌id
var titleStrArr:Array<String>? = []
var goods_id:Int?
var sku_id:Int?
var goodsDetailModel:GoodsDetailModel? = nil
var editActionArr = ["保存"]
func GLASClose(view: GLAlertSelectView, selectnum: Int, selectArr: Array<Int>) {
......@@ -382,17 +384,16 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo
break
case "入库":
HUD.flash(.label("敬请期待"),delay: 1.2)
return
// let vc = RuKuViewController()
// vc.barTitle = "入库"
// self.navigationController?.pushViewController(vc, animated: true)
let vc = NewRKVc()
vc.goods_id = goods_id!
vc.sku_id = sku_id!
self.navigationController?.pushViewController(vc, animated: true)
break
case "出库":
HUD.flash(.label("敬请期待"),delay: 1.2)
return
// let vc = ChuKuViewController()
// self.navigationController?.pushViewController(vc, animated: true)
let vc = NewCKVc()
vc.goods_id = goods_id!
vc.sku_id = sku_id!
self.navigationController?.pushViewController(vc, animated: true)
break
case "上架":
//提示是否上架
......@@ -1831,7 +1832,6 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo
func getNewPicDictsArray()->String{
print("源数据")
print(goods_banner)
var tempArr:Array<String> = []
var tempOldArr:Array<GoodsDetailBannerResModel> = []
goodsDetailModel!.data!.banner_res!.forEach { (model) in
......
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