Commit cc21e5b8 authored by lujunye's avatar lujunye

打印界面大致完成

parent 6a9ab706
...@@ -408,6 +408,10 @@ ...@@ -408,6 +408,10 @@
E0E341EB246E95EE0060AC20 /* PingLunCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0E341E9246E95EE0060AC20 /* PingLunCell.xib */; }; E0E341EB246E95EE0060AC20 /* PingLunCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0E341E9246E95EE0060AC20 /* PingLunCell.xib */; };
E0E4456924B00F7B00EF788E /* LogisticsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0E4456824B00F7B00EF788E /* LogisticsModel.swift */; }; E0E4456924B00F7B00EF788E /* LogisticsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0E4456824B00F7B00EF788E /* LogisticsModel.swift */; };
E0E4456B24B0221500EF788E /* LogisticsInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0E4456A24B0221500EF788E /* LogisticsInterface.swift */; }; E0E4456B24B0221500EF788E /* LogisticsInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0E4456A24B0221500EF788E /* LogisticsInterface.swift */; };
E0E5604F25C167220004BA56 /* Print_Gprinter_View.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0E5604E25C167220004BA56 /* Print_Gprinter_View.swift */; };
E0E5605425C1672E0004BA56 /* Print_Gprinter_View.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0E5605325C1672E0004BA56 /* Print_Gprinter_View.xib */; };
E0E5605A25C169E30004BA56 /* GPrinter_Cell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0E5605825C169E30004BA56 /* GPrinter_Cell.swift */; };
E0E5605B25C169E30004BA56 /* GPrinter_Cell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0E5605925C169E30004BA56 /* GPrinter_Cell.xib */; };
E0E7CB6124C17B9F00A26D3F /* GLKHCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0E7CB5F24C17B9F00A26D3F /* GLKHCell.swift */; }; E0E7CB6124C17B9F00A26D3F /* GLKHCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0E7CB5F24C17B9F00A26D3F /* GLKHCell.swift */; };
E0E7CB6224C17B9F00A26D3F /* GLKHCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0E7CB6024C17B9F00A26D3F /* GLKHCell.xib */; }; E0E7CB6224C17B9F00A26D3F /* GLKHCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0E7CB6024C17B9F00A26D3F /* GLKHCell.xib */; };
E0E8ABFD246E359700E3BB54 /* GuiGeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0E8ABFC246E359700E3BB54 /* GuiGeModel.swift */; }; E0E8ABFD246E359700E3BB54 /* GuiGeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0E8ABFC246E359700E3BB54 /* GuiGeModel.swift */; };
...@@ -1141,6 +1145,10 @@ ...@@ -1141,6 +1145,10 @@
E0E341E9246E95EE0060AC20 /* PingLunCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PingLunCell.xib; sourceTree = "<group>"; }; E0E341E9246E95EE0060AC20 /* PingLunCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PingLunCell.xib; sourceTree = "<group>"; };
E0E4456824B00F7B00EF788E /* LogisticsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogisticsModel.swift; sourceTree = "<group>"; }; E0E4456824B00F7B00EF788E /* LogisticsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogisticsModel.swift; sourceTree = "<group>"; };
E0E4456A24B0221500EF788E /* LogisticsInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogisticsInterface.swift; sourceTree = "<group>"; }; E0E4456A24B0221500EF788E /* LogisticsInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogisticsInterface.swift; sourceTree = "<group>"; };
E0E5604E25C167220004BA56 /* Print_Gprinter_View.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Print_Gprinter_View.swift; sourceTree = "<group>"; };
E0E5605325C1672E0004BA56 /* Print_Gprinter_View.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = Print_Gprinter_View.xib; sourceTree = "<group>"; };
E0E5605825C169E30004BA56 /* GPrinter_Cell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GPrinter_Cell.swift; sourceTree = "<group>"; };
E0E5605925C169E30004BA56 /* GPrinter_Cell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GPrinter_Cell.xib; sourceTree = "<group>"; };
E0E7CB5F24C17B9F00A26D3F /* GLKHCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GLKHCell.swift; sourceTree = "<group>"; }; E0E7CB5F24C17B9F00A26D3F /* GLKHCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GLKHCell.swift; sourceTree = "<group>"; };
E0E7CB6024C17B9F00A26D3F /* GLKHCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GLKHCell.xib; sourceTree = "<group>"; }; E0E7CB6024C17B9F00A26D3F /* GLKHCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GLKHCell.xib; sourceTree = "<group>"; };
E0E8ABFC246E359700E3BB54 /* GuiGeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GuiGeModel.swift; sourceTree = "<group>"; }; E0E8ABFC246E359700E3BB54 /* GuiGeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GuiGeModel.swift; sourceTree = "<group>"; };
...@@ -2001,6 +2009,10 @@ ...@@ -2001,6 +2009,10 @@
E01313DF25C00496006CFA5D /* Add_Report_View.xib */, E01313DF25C00496006CFA5D /* Add_Report_View.xib */,
E0974D6A25C140A600E3C86B /* S_Y_Detail_Vc.swift */, E0974D6A25C140A600E3C86B /* S_Y_Detail_Vc.swift */,
E0974D6B25C140A600E3C86B /* S_Y_Detail_Vc.xib */, E0974D6B25C140A600E3C86B /* S_Y_Detail_Vc.xib */,
E0E5604E25C167220004BA56 /* Print_Gprinter_View.swift */,
E0E5605325C1672E0004BA56 /* Print_Gprinter_View.xib */,
E0E5605825C169E30004BA56 /* GPrinter_Cell.swift */,
E0E5605925C169E30004BA56 /* GPrinter_Cell.xib */,
); );
path = "溯源"; path = "溯源";
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -3716,6 +3728,7 @@ ...@@ -3716,6 +3728,7 @@
F9A1D4AB255B7AF70018DA8A /* RetailManageHeaderView.xib in Resources */, F9A1D4AB255B7AF70018DA8A /* RetailManageHeaderView.xib in Resources */,
E00CBA0224820CF000701D9D /* CRKSumCell.xib in Resources */, E00CBA0224820CF000701D9D /* CRKSumCell.xib in Resources */,
E0206335246CE45A007A40C4 /* HeaderOnlyTitleView.xib in Resources */, E0206335246CE45A007A40C4 /* HeaderOnlyTitleView.xib in Resources */,
E0E5605425C1672E0004BA56 /* Print_Gprinter_View.xib in Resources */,
E0B903CA259B11C20041EF62 /* FXSY_Detail_ViewController.xib in Resources */, E0B903CA259B11C20041EF62 /* FXSY_Detail_ViewController.xib in Resources */,
E0A409D524640B8300CFF109 /* DZGLViewController.xib in Resources */, E0A409D524640B8300CFF109 /* DZGLViewController.xib in Resources */,
F95567A82453DA86009674AB /* WarehoseMangementListVC.xib in Resources */, F95567A82453DA86009674AB /* WarehoseMangementListVC.xib in Resources */,
...@@ -3731,6 +3744,7 @@ ...@@ -3731,6 +3744,7 @@
E00D85EB244561FE00F5F816 /* LaunchScreen.storyboard in Resources */, E00D85EB244561FE00F5F816 /* LaunchScreen.storyboard in Resources */,
E0AD92EA2550E50500D82C17 /* GYS_FX_Product_VC.xib in Resources */, E0AD92EA2550E50500D82C17 /* GYS_FX_Product_VC.xib in Resources */,
E02FD9FB24557E8600E10E27 /* XinZengDiZhiViewController.xib in Resources */, E02FD9FB24557E8600E10E27 /* XinZengDiZhiViewController.xib in Resources */,
E0E5605B25C169E30004BA56 /* GPrinter_Cell.xib in Resources */,
E0B94624245671E100FBEC9A /* DaiKeXiaDanGouWuViewController.xib in Resources */, E0B94624245671E100FBEC9A /* DaiKeXiaDanGouWuViewController.xib in Resources */,
F9023F722449ACA800DD5A63 /* TitleAndSwitchCell.xib in Resources */, F9023F722449ACA800DD5A63 /* TitleAndSwitchCell.xib in Resources */,
E08B0675244A98B2001D2E01 /* WareHouseSpCell.xib in Resources */, E08B0675244A98B2001D2E01 /* WareHouseSpCell.xib in Resources */,
...@@ -3960,6 +3974,7 @@ ...@@ -3960,6 +3974,7 @@
E0B94623245671E100FBEC9A /* DaiKeXiaDanGouWuViewController.swift in Sources */, E0B94623245671E100FBEC9A /* DaiKeXiaDanGouWuViewController.swift in Sources */,
E0D11BD525C12C540066DB21 /* img_title_cell.swift in Sources */, E0D11BD525C12C540066DB21 /* img_title_cell.swift in Sources */,
E0A320C52456D01300AF321C /* DaiKeXiaDanFooterView.swift in Sources */, E0A320C52456D01300AF321C /* DaiKeXiaDanFooterView.swift in Sources */,
E0E5605A25C169E30004BA56 /* GPrinter_Cell.swift in Sources */,
E0336DD5244EC40000380BE9 /* CreatNewSpecsViewController.swift in Sources */, E0336DD5244EC40000380BE9 /* CreatNewSpecsViewController.swift in Sources */,
F9531F3F2465108800724BEE /* JXPhotoBrowserNumberPageIndicator.swift in Sources */, F9531F3F2465108800724BEE /* JXPhotoBrowserNumberPageIndicator.swift in Sources */,
E0272A85259C2525008142BB /* FXYGL_ViewController.swift in Sources */, E0272A85259C2525008142BB /* FXYGL_ViewController.swift in Sources */,
...@@ -4112,6 +4127,7 @@ ...@@ -4112,6 +4127,7 @@
E07C2FFA24ECCD4D0043649B /* GLMessageAlertView.swift in Sources */, E07C2FFA24ECCD4D0043649B /* GLMessageAlertView.swift in Sources */,
E0A409D02464041200CFF109 /* ThirdCell.swift in Sources */, E0A409D02464041200CFF109 /* ThirdCell.swift in Sources */,
F956D59F246A2D9C003FF510 /* LMNPhotoCollectionCell.m in Sources */, F956D59F246A2D9C003FF510 /* LMNPhotoCollectionCell.m in Sources */,
E0E5604F25C167220004BA56 /* Print_Gprinter_View.swift in Sources */,
F950FDE424518B9500C40530 /* FSCalendarTransitionCoordinator.m in Sources */, F950FDE424518B9500C40530 /* FSCalendarTransitionCoordinator.m in Sources */,
F9B6D9E12486890D00111698 /* MoreAndTimeSelectView.swift in Sources */, F9B6D9E12486890D00111698 /* MoreAndTimeSelectView.swift in Sources */,
E0BE8A90245A9B9600E80134 /* YingFuZhangKuanCell.swift in Sources */, E0BE8A90245A9B9600E80134 /* YingFuZhangKuanCell.swift in Sources */,
......
...@@ -116,21 +116,21 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo ...@@ -116,21 +116,21 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo
@IBOutlet weak var gm_view: UIView! @IBOutlet weak var gm_view: UIView!
@IBAction func ck_action(_ sender: UIButton) { @IBAction func ck_action(_ sender: UIButton) {
if typeSelect == nil { // if typeSelect == nil {
HUD.flash(.label("请选择出库类型"),delay: 1.2) // HUD.flash(.label("请选择出库类型"),delay: 1.2)
return // return
} // }
if remark.count == 0 { // if remark.count == 0 {
HUD.flash(.label("请填写备注"), delay: 1.2) // HUD.flash(.label("请填写备注"), delay: 1.2)
return // return
} // }
if rkSelectArr.count == 0 { if rkSelectArr.count == 0 {
HUD.flash(.label("请选择出库商品"), delay: 1.2) HUD.flash(.label("请选择出库商品"), delay: 1.2)
return return
} }
HUD.show(.progress)
var goodsInfoArr:Array<Any> = [] var goodsInfoArr:Array<Any> = []
for i in 0 ..< rkSelectArr.count { for i in 0 ..< rkSelectArr.count {
let item = rkSelectArr[i] let item = rkSelectArr[i]
...@@ -172,27 +172,30 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo ...@@ -172,27 +172,30 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo
] ]
goodsInfoArr.append(goods) goodsInfoArr.append(goods)
} }
if typeSelect != nil {
let dict = [ let dict = [
"user_token":UserToken as Any, "user_token":UserToken as Any,
"o_type":typeSelect! + 1 as Any, "o_type":typeSelect! + 1 as Any,
"audit_remark":remark as Any, "audit_remark":remark as Any,
"goods_info":dataChangeString(sender: goodsInfoArr) as Any "goods_info":dataChangeString(sender: goodsInfoArr) as Any
] ]
}
if sender.tag == 1 {//打印 if sender.tag == 1 {//打印
print("连接打印机") print("连接打印机")
let vc = Print_Gprinter_View(frame: self.view.bounds)
vc.rkSelectArr = rkSelectArr
vc.piCiArr = piCiArr
self.view.addSubview(vc)
return return
} }
GoodsOutput(dict, success: { (data) in HUD.show(.progress)
HUD.hide() // GoodsOutput(dict, success: { (data) in
HUD.flash(.labeledSubSuccess(subtitle: "出库成功"), delay: 1.2) // HUD.hide()
// HUD.flash(.labeledSubSuccess(subtitle: "出库成功"), delay: 1.2)
self.navigationController?.popViewController(animated: true) // self.navigationController?.popViewController(animated: true)
}) { (error) in // }) { (error) in
//
} // }
} }
@IBOutlet weak var btmBtn: LGButton! @IBOutlet weak var btmBtn: LGButton!
@IBOutlet weak var btmLbl: UILabel! @IBOutlet weak var btmLbl: UILabel!
......
//
// GPrinter_Cell.swift
// GeliBusinessPlatform
//
// Created by junye lu on 2021/1/27.
// Copyright © 2021 junye lu. All rights reserved.
//
import UIKit
protocol GPrinter_Cell_Delegate {
func GPrinter_Cell_select_item(selects:Array<Int>,cell:GPrinter_Cell)
}
class GPrinter_Cell: UITableViewCell {
var delegate:GPrinter_Cell_Delegate?
@IBOutlet weak var title_lbl_3: UILabel!
@IBOutlet weak var title_lbl_2: UILabel!
@IBOutlet weak var title_lbl_1: UILabel!
@IBAction func select_all(_ sender: UIButton) {
all_select_btn.isSelected = !all_select_btn.isSelected
if all_select_btn.isSelected {
select_arr.removeAll()
for i in 0 ..< piciArr.count {
select_arr.append(i)
}
}else{
select_arr.removeAll()
for _ in 0 ..< piciArr.count {
select_arr.append(999999)
}
}
delegate?.GPrinter_Cell_select_item(selects: select_arr, cell: self)
}
@IBOutlet weak var bg_view: UIView!
@IBOutlet weak var all_select_btn: UIButton!
@IBOutlet weak var name_lbl: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
self.selectionStyle = .none
}
func setUI(){
if bg_view.subviews.count > 0 {
bg_view.subviews.forEach { (item) in
item.removeFromSuperview()
}
}
if piciArr.count == 0 {return}
for i in 0 ..< piciArr.count {
if select_arr.count != piciArr.count {
select_arr.append(999999)
}
let view = UIView()
view.tag = i
bg_view.addSubview(view)
view.snp.makeConstraints { (make) in
make.left.right.equalTo(0)
make.height.equalTo(67)
make.top.equalTo(i * 67)
}
let btn = UIButton(frame: CGRect(x: 0, y: 0, width: 44, height: 67))
btn.tag = i
view.addSubview(btn)
btn.setImage(UIImage(named: "daixuan"), for: .normal)
btn.setImage(UIImage(named: "yuxuan"), for: .selected)
btn.addTarget(self, action: #selector(single_select(btn:)), for: .touchUpInside)
if btn.tag == select_arr[i] {
btn.isSelected = true
}else{
btn.isSelected = false
}
let num_lbl = UILabel()
num_lbl.textColor = UIColor(named: "个人中心灰色字体")
num_lbl.font = UIFont.systemFont(ofSize: 13)
view.addSubview(num_lbl)
num_lbl.text = "330"
num_lbl.snp.makeConstraints { (make) in
make.centerY.equalTo(btn.snp_centerY)
make.centerX.equalTo(title_lbl_1.snp_centerX)
}
let type_lbl = UILabel()
type_lbl.textColor = UIColor(named: "个人中心灰色字体")
type_lbl.font = UIFont.systemFont(ofSize: 13)
view.addSubview(type_lbl)
type_lbl.text = "正常"
type_lbl.snp.makeConstraints { (make) in
make.centerY.equalTo(btn.snp_centerY)
make.centerX.equalTo(title_lbl_2.snp_centerX)
}
}
}
var select_arr:Array<Int> = []
override func layoutIfNeeded() {
super.layoutIfNeeded()
for i in 0 ..< bg_view.subviews.count {
let view = bg_view.subviews[i]
if view.tag == select_arr[i] {
view.subviews.forEach { (item) in
if item.isMember(of: UIButton.classForCoder()){
let btn = item as! UIButton
btn.isSelected = true
}
}
}else{
view.subviews.forEach { (item) in
if item.isMember(of: UIButton.classForCoder()){
let btn = item as! UIButton
btn.isSelected = false
}
}
}
}
}
@objc func single_select(btn:UIButton){
if btn.isSelected {
btn.isSelected = false
select_arr.insert(999999, at: btn.tag)
select_arr.remove(at: btn.tag+1)
}else{
btn.isSelected = true
select_arr.insert(btn.tag, at: btn.tag)
select_arr.remove(at: btn.tag+1)
}
if select_arr.contains(999999){
all_select_btn.isSelected = false
}else{
all_select_btn.isSelected = true
}
delegate?.GPrinter_Cell_select_item(selects: select_arr, cell: self)
}
var piciArr:Array<GetGoodBatchDataModel> = []{
didSet{
setUI()
}
}
@IBOutlet weak var btm_line: UIView!
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
This diff is collapsed.
//
// Print_Gprinter_View.swift
// GeliBusinessPlatform
//
// Created by junye lu on 2021/1/27.
// Copyright © 2021 junye lu. All rights reserved.
//
import UIKit
import LGButton
class Print_Gprinter_View: UIView,UITableViewDelegate,UITableViewDataSource, GPrinter_Cell_Delegate {
func GPrinter_Cell_select_item(selects: Array<Int>, cell: GPrinter_Cell) {
pi_ci_select.insert(selects, at: cell.tag)
pi_ci_select.remove(at: cell.tag+1)
cell.layoutIfNeeded()
list_view.reloadData()
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return rkSelectArr.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "GPrinter_Cell") as! GPrinter_Cell
cell.delegate = self
cell.select_arr = pi_ci_select[indexPath.row]
cell.tag = indexPath.row
let model = rkSelectArr[indexPath.row]
cell.name_lbl.text = model.goods_name
cell.piciArr = piCiArr![indexPath.row]
cell.btm_line.isHidden = false
if indexPath.row == rkSelectArr.count - 1 {
cell.btm_line.isHidden = true
}
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
let pici = piCiArr![indexPath.row]
return CGFloat(103 + 67 * pici.count)
}
var rkSelectArr:Array<InputInitInfoGoodsInfoModel> = []{
didSet {
for i in 0 ..< rkSelectArr.count {
pi_ci_select.append([])
}
}
}//产品选择
var piCiArr:Array<Array<GetGoodBatchDataModel>>? = []
var contentView:UIView!
var pi_ci_select:Array<Array<Int>> = []
@IBOutlet weak var list_view: UITableView!
@IBAction func print_action(_ sender: LGButton) {
}
@IBAction func close_action(_ sender: UIButton) {
self.removeFromSuperview()
}
//初始化时将xib中的view添加进来
override init(frame: CGRect) {
super.init(frame: frame)
contentView = loadViewFromNib()
addSubview(contentView)
contentView.snp.makeConstraints { (make) in
make.left.top.right.bottom.equalToSuperview()
}
list_view.register(UINib(nibName: "GPrinter_Cell", bundle: nil), forCellReuseIdentifier: "GPrinter_Cell")
list_view.separatorStyle = .none
}
// /初始化时将xib中的view添加进来
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
contentView = loadViewFromNib()
addSubview(contentView)
contentView.snp.makeConstraints { (make) in
make.left.top.right.bottom.equalToSuperview()
}
list_view.register(UINib(nibName: "GPrinter_Cell", bundle: nil), forCellReuseIdentifier: "GPrinter_Cell")
list_view.separatorStyle = .none
}
//加载xib
func loadViewFromNib() -> UIView {
let className = type(of: self)
let bundle = Bundle(for: className)
let name = NSStringFromClass(className).components(separatedBy: ".").last
let nib = UINib(nibName: name!, bundle: bundle)
let view = nib.instantiate(withOwner: self, options: nil).first as! UIView
return view
}
}
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