Commit 25b9b284 authored by lujunye's avatar lujunye

30

parent cfa90891
......@@ -21,7 +21,7 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne
print_list.reloadData()
}
var piCiArr:Array<Array<goodsInputBatchData>>? = []
let printBG = UIButton()
let title_Lbl = UILabel()
let print_list = UITableView()
......@@ -39,7 +39,7 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne
data.forEach { (dict) in
printData.append(dict)
}
print("打印")
print("打印,",printData.count)
printBG.backgroundColor = UIColor.black
printBG.alpha = 0.4
......@@ -66,6 +66,7 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne
print_list.register(UINib(nibName: "NewPrintItemCell", bundle: nil), forCellReuseIdentifier: "NewPrintItemCell")
print_list.delegate = self
print_list.dataSource = self
print_list.backgroundColor = UIColor.white
print_list.snp.makeConstraints { (make) in
make.left.right.bottom.equalTo(0)
make.top.equalTo(title_Lbl.snp_bottom)
......@@ -103,6 +104,7 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne
title_Lbl.removeFromSuperview()
print_list.removeFromSuperview()
printBG.removeFromSuperview()
self.navigationController?.popViewController(animated: true)
}
}
})
......@@ -110,11 +112,11 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne
}
var wkWebView:WKWebView?
func printData(idx:Int){
let model = printData[idx]["goods_data"] as! GetGoodBatchDataModel
let model = printData[idx]["goods_data"] as! goodsInputBatchData
//测试
// let urlStr = "http://z.gelifood.com/static/url/label.html?goods_name=\(printData[idx]["goods_name"] as! String)&spec_str=\(printData[idx]["spec_str"] as! String)&batch_sn=\(model.batch_sn!)&batch_id=\(model.batch_id!)&iscs=1"
let urlStr = "http://z.gelifood.com/static/url/label.html?goods_name=\(printData[idx]["goods_name"] as! String)&spec_str=\(printData[idx]["spec_str"] as! String)&batch_sn=\(model.batch_sn!)&batch_id=\(model.batch_id!)&iscs=1"
//online
let urlStr = "http://zx.gelifood.com/static/url/label.html?goods_name=\(printData[idx]["goods_name"] as! String)&spec_str=\(printData[idx]["spec_str"] as! String)&batch_sn=\(model.batch_sn!)&batch_id=\(model.batch_id!)&iscs=0"
// let urlStr = "http://zx.gelifood.com/static/url/label.html?goods_name=\(printData[idx]["goods_name"] as! String)&spec_str=\(printData[idx]["spec_str"] as! String)&batch_sn=\(model.batch_sn!)&batch_id=\(model.batch_id!)&iscs=0"
let urlString = urlStr.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!
let url = URL(string: urlString)
if wkWebView == nil {
......@@ -368,22 +370,10 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne
return
}
}
HUD.show(.progress)
if lgBtnTitLbl.text != "提交申请"{
let appdelegate = UIApplication.shared.delegate as! AppDelegate
if sender.tag == 1 {
if appdelegate.blueToothVC.isLink {
let vc = Print_Gprinter_View(frame: self.view.bounds)
vc.delegate = self
vc.rkSelectArr = rkSelectArr
vc.piCiArr = []
self.view.addSubview(vc)
}else{
HUD.flash(.label("请连接打印机"), onView: self.view, delay: 1.2) { (data) in
self.navigationController?.pushViewController(appdelegate.blueToothVC, animated: true)
}
}
}else{
HUD.show(.progress)
var goodsInfoArr:Array<Any>? = []
for i in 0 ..< rkSelectArr.count {
let model = rkSelectArr[i]
......@@ -435,10 +425,41 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne
"g_type":selectTypeSelect + 1 as Any,
"goods_info":goods_info as Any
]
if sender.tag == 1 {
let appdelegate = UIApplication.shared.delegate as! AppDelegate
if appdelegate.blueToothVC.isLink {
GoodsInput(dict, success: { (data) in
HUD.hide()
HUD.flash(.labeledSubSuccess(subtitle: "入库成功"), delay: 1.2)
self.delegate?.NewRKVcFinish()
let model = data as! goodsInputModel
self.piCiArr?.removeAll()
model.data?.forEach({ item in
self.piCiArr?.append(item.batch_info!)
})
let vc = Print_Gprinter_View(frame: self.view.bounds)
vc.delegate = self
vc.is_rk = true
vc.rkSelectArr = self.rkSelectArr
vc.rk_piciArr = self.piCiArr
self.view.addSubview(vc)
// self.navigationController?.popViewController(animated: true)
}) { (error) in
}
}else{
HUD.flash(.label("请连接打印机"), onView: self.view, delay: 1.2) { (data) in
self.navigationController?.pushViewController(appdelegate.blueToothVC, animated: true)
}
}
}else{
GoodsInput(dict, success: { (data) in
HUD.hide()
HUD.flash(.labeledSubSuccess(subtitle: "入库成功"), delay: 1.2)
self.delegate?.NewRKVcFinish()
self.navigationController?.popViewController(animated: true)
}) { (error) in
......@@ -448,6 +469,7 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne
}else{
HUD.show(.progress)
var goodsInfoArr:Array<Any>? = []
for i in 0 ..< rkSelectArr.count {
let model = rkSelectArr[i]
......@@ -1064,18 +1086,12 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne
vc.report_type_arr = report_type_arr
self.navigationController?.pushViewController(vc, animated: true)
}
// func getStrHeight(str:String) -> CGFloat{
// let lbl = UILabel()
// lbl.text = titleArr.last
// lbl.font = UIFont.systemFont(ofSize: 13)
// lbl.sizeToFit()
// let margin = lbl.bounds.size.width + 77
// let viewSize = CGSize(width:fullScreenWidth - margin , height: CGFloat(MAXFLOAT))
// let font = UIFont.systemFont(ofSize: 13)
// return (str as NSString).boundingRect(with: viewSize, options: [.usesLineFragmentOrigin], attributes: [NSAttributedString.Key.font:font], context: nil).height
// }
//MARK: - cell delegate
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if tableView == print_list {
return 83
}
if indexPath.section == 0 {
if isGm == false {
if indexPath.row < 2{
......@@ -1097,6 +1113,7 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
if tableView != print_list {
if section == 0 {
let view = UIView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 10))
view.backgroundColor = UIColor(named: "app底色")
......@@ -1125,8 +1142,15 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne
return view
}
}
let view = UIView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 10))
view.backgroundColor = UIColor(named: "app底色")
return view
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
if tableView == print_list {
return 0.001
}
if section == 0 {
return 10
}
......@@ -1136,6 +1160,8 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne
return 0.001
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
if tableView != print_list {
if section == 1 {
let view = UIView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 39))
let lbl = UILabel(frame: CGRect(x: 15, y: 15, width: fullScreenWidth, height: 21))
......@@ -1154,10 +1180,14 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne
}
return view
}
}
return UIView()
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
if tableView == print_list {
return 0.001
}
if section == 1 {
if rkSelectArr.count > 0 {
return 49
......@@ -1168,15 +1198,22 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne
}
func numberOfSections(in tableView: UITableView) -> Int {
if tableView == print_list {
return 1
}
return 2
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if tableView == print_list {
return printData.count
}else{
if section == 0 {
return titleArr.count
}
return rkSelectArr.count
}
}
func NewSelectWarehouseVCFinish(kuWeiArr: Array<ShopWarehouseDetailDataPositionModel>, data: InputInitInfoWareHouseResModel) {
holderArr.insert(data.w_name!, at: 0)
holderArr.remove(at: 1)
......
......@@ -358,6 +358,7 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo
let vc = Print_Gprinter_View(frame: self.view.bounds)
vc.delegate = self
vc.rkSelectArr = rkSelectArr
print(piCiArr?.count)
vc.piCiArr = piCiArr
self.view.addSubview(vc)
}else{
......
......@@ -24,7 +24,6 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
AddressDel(["user_token":UserToken as Any,"address_id":model.address_id as Any], success: { (data) in
self.listView.mj_header?.beginRefreshing()
}) { (error) in
}
}
......
......@@ -4,6 +4,7 @@
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
......@@ -20,7 +21,7 @@
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="OWf-Av-nZU">
<rect key="frame" x="15" y="12.5" width="33" height="19"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="13"/>
<nil key="textColor"/>
<color key="textColor" name="标题字颜色"/>
<nil key="highlightedColor"/>
</label>
<imageView hidden="YES" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="jinru" translatesAutoresizingMaskIntoConstraints="NO" id="vZj-x0-0S4">
......@@ -57,5 +58,8 @@
</objects>
<resources>
<image name="jinru" width="13" height="23"/>
<namedColor name="标题字颜色">
<color red="0.18000000715255737" green="0.18000000715255737" blue="0.18000000715255737" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</document>
......@@ -134,6 +134,9 @@ class XinZengAndBianJiKeHuViewController: BaseViewController,UITableViewDataSour
self.view.window?.addSubview(alertView)
}
var adrArr:Array<GetAddrsInfoDataModel> = []
var titleStr:String?
let UserToken = UserDefaults.standard.value(forKey: "user_token")
let titleArr = ["客户名称","客户手机号码 ","客户公司名称","绑定用户","客户类型","客户折扣","客户地址管理"]
......@@ -156,12 +159,22 @@ class XinZengAndBianJiKeHuViewController: BaseViewController,UITableViewDataSour
listView.isScrollEnabled = false
top_margin.constant = NavCGRect.height-49
tbv_h.constant = CGFloat(49*titleArr.count)
listView.register(UINib(nibName: "TitleAndBtnCell", bundle: nil), forCellReuseIdentifier: "TitleAndBtnCell")
listView.register(UINib(nibName: "TitleAndTFCell", bundle: nil), forCellReuseIdentifier: "TitleAndTFCell")
listView.register(UINib(nibName: "Title_Btn_Cell", bundle: nil), forCellReuseIdentifier: "Title_Btn_Cell")
getAddrsInfo(["user_token":UserToken as Any,"cus_id":cus_id as Any]) { data in
self.adrArr.removeAll()
let model = data as! GetAddrsInfoModel
model.data?.forEach({ item in
self.adrArr.append(item)
})
self.listView.reloadData()
} failture: { err in
}
}
//MARK: - CELL DELEGATE
......@@ -174,6 +187,8 @@ class XinZengAndBianJiKeHuViewController: BaseViewController,UITableViewDataSour
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.row == 6 {
print("abc == ")
let vc = DZGLViewController()
self.navigationController?.pushViewController(vc, animated: true )
}
if indexPath.row == 3 {
let vc = BingDingKeHuViewController()
......@@ -237,6 +252,10 @@ class XinZengAndBianJiKeHuViewController: BaseViewController,UITableViewDataSour
if indexPath.row == 6 {
let cell = tableView.dequeueReusableCell(withIdentifier: "Title_Btn_Cell") as! Title_Btn_Cell
cell.title_lbl.text = titleArr[indexPath.row]
if adrArr.count != 0 {
cell.add_adr_lbl.isHidden = true
cell.arrow_img.isHidden = false
}
return cell
}
......
......@@ -27,7 +27,7 @@ class Add_Report_View: UIView {
item.removeFromSuperview()
}
btm_view.insertSubview(scrollView, at: btm_view.subviews.count-1)
btm_view.insertSubview(scrollView, at: 0)
scrollView.frame = CGRect(x: 15, y: add_img_btn.frame.maxY+20, width: ScreenWidth - 30, height: 100.5)
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
......@@ -223,7 +223,7 @@
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<color key="backgroundColor" name="白色背景色"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="qIU-Ju-6TU" secondAttribute="trailing" constant="15" id="3J3-RD-yfE"/>
<constraint firstItem="qIU-Ju-6TU" firstAttribute="leading" secondItem="1E2-Hg-cjR" secondAttribute="leading" constant="15" id="4eE-fj-9YJ"/>
......
......@@ -41,20 +41,7 @@ class GPrinter_Cell: UITableViewCell {
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)
print_copy_arr.append(1)
}
func ui(i:Int){
let view = UIView()
view.tag = i
bg_view.addSubview(view)
......@@ -155,6 +142,36 @@ class GPrinter_Cell: UITableViewCell {
make.width.height.equalTo(28)
}
}
func setUI(){
if bg_view.subviews.count > 0 {
bg_view.subviews.forEach { (item) in
item.removeFromSuperview()
}
}
if is_rk {
if rk_piciArr.count == 0 {
return
}
for i in 0 ..< rk_piciArr.count {
if select_arr.count != rk_piciArr.count {
select_arr.append(999999)
print_copy_arr.append(1)
}
ui(i:i)
}
}else{
if piciArr.count == 0 {
return
}
for i in 0 ..< piciArr.count {
if select_arr.count != piciArr.count {
select_arr.append(999999)
print_copy_arr.append(1)
}
ui(i:i)
}
}
}
var select_arr:Array<Int> = []
var print_copy_arr:Array<Int> = []
......@@ -237,7 +254,7 @@ class GPrinter_Cell: UITableViewCell {
}
}
}
var is_rk = false
@objc func single_select(btn:UIButton){
if btn.isSelected {
btn.isSelected = false
......@@ -262,6 +279,11 @@ class GPrinter_Cell: UITableViewCell {
setUI()
}
}
var rk_piciArr:Array<goodsInputBatchData> = []{
didSet{
setUI()
}
}
......
......@@ -26,7 +26,7 @@ class Print_Gprinter_View: UIView,UITableViewDelegate,UITableViewDataSource, GPr
var print_num_arr:Array<Array<Int>> = []
var is_rk = false
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return rkSelectArr.count
......@@ -40,8 +40,11 @@ class Print_Gprinter_View: UIView,UITableViewDelegate,UITableViewDataSource, GPr
cell.tag = indexPath.row
let model = rkSelectArr[indexPath.row]
cell.name_lbl.text = model.goods_name
if piCiArr!.count > 0 {
cell.is_rk = is_rk
if is_rk == false {
cell.piciArr = piCiArr![indexPath.row]
}else{
cell.rk_piciArr = rk_piciArr![indexPath.row]
}
cell.btm_line.isHidden = false
if indexPath.row == rkSelectArr.count - 1 {
......@@ -51,11 +54,13 @@ class Print_Gprinter_View: UIView,UITableViewDelegate,UITableViewDataSource, GPr
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if piCiArr!.count > 0 {
if is_rk == false {
let pici = piCiArr![indexPath.row]
return CGFloat(103 + 67 * pici.count)
}else{
let pici = rk_piciArr![indexPath.row]
return CGFloat(103 + 67 * pici.count)
}
return 170
}
var rkSelectArr:Array<InputInitInfoGoodsInfoModel> = []{
didSet {
......@@ -66,6 +71,7 @@ class Print_Gprinter_View: UIView,UITableViewDelegate,UITableViewDataSource, GPr
}
}//产品选择
var piCiArr:Array<Array<GetGoodBatchDataModel>>? = []
var rk_piciArr:Array<Array<goodsInputBatchData>>? = []
var contentView:UIView!
var pi_ci_select:Array<Array<Int>> = []
@IBOutlet weak var list_view: UITableView!
......@@ -99,9 +105,12 @@ class Print_Gprinter_View: UIView,UITableViewDelegate,UITableViewDataSource, GPr
var dict:Dictionary<String,Any> = Dictionary()
for i in select_arr {
dict["goods_name"] = model.goods_name
if piCiArr!.count > 0 {
if is_rk == false {
let p = piCiArr![item][i]
dict["goods_data"] = p
}else{
let p = rk_piciArr![item][i]
dict["goods_data"] = p
}
let n = print_num_arr[item][i]
dict["print_counts"] = n
......@@ -110,8 +119,12 @@ class Print_Gprinter_View: UIView,UITableViewDelegate,UITableViewDataSource, GPr
}
}
for item in print_data {
if is_rk == false {
let data = item["goods_data"] as! GetGoodBatchDataModel
print("print_target = ",item["goods_name"],data.batch_id,item["print_counts"])
// print("print_target = ",item["goods_name"],data.batch_id,item["print_counts"])
}else{
let data = item["goods_data"] as! goodsInputBatchData
}
}
self.removeFromSuperview()
//连接打印机
......
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