Commit b6508b0e authored by 曹云霄's avatar 曹云霄

修复问题《费用信息只有总价没有明细,且没有借用信息》

parent d693d5c8
...@@ -35,10 +35,10 @@ class ChildBillDetailCostViewController: BaseTableViewController { ...@@ -35,10 +35,10 @@ class ChildBillDetailCostViewController: BaseTableViewController {
fileprivate func setupDataAction() { fileprivate func setupDataAction() {
logisticsLabel.text = costModel.materiel.name logisticsLabel.text = costModel.materiel.name
priceLabel.text = String(format: "%.2f", costModel.unitPrice) priceLabel.text = String(format: "%.2f", costModel.unitPrice)
countLabel.text = String(format: "%.2f", costModel.getQty) countLabel.text = String(format: "%.2f", costModel.useQty)
totalPriceLabel.text = String(format: "%.2f", costModel.getQty * costModel.unitPrice) totalPriceLabel.text = String(format: "%.2f", costModel.unitPrice * costModel.useQty)
extractCountLabel.text = String(format: "%.0f", costModel.getQty) extractCountLabel.text = String(format: "%.2f", costModel.getQty)
returnCountLabel.text = String(format: "%.0f", costModel.useQty) returnCountLabel.text = String(format: "%.2f", costModel.backQty)
} }
override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
......
...@@ -57,6 +57,9 @@ class RepairOrderCompletedViewController: BaseTableViewController { ...@@ -57,6 +57,9 @@ class RepairOrderCompletedViewController: BaseTableViewController {
billCompleteViewModel.billCompltedModel.finishTime = NSDate().httpParameterString() billCompleteViewModel.billCompltedModel.finishTime = NSDate().httpParameterString()
let finishModel = UCN(kUser().userCode, kUser().userName, kUser().userUuid) let finishModel = UCN(kUser().userCode, kUser().userName, kUser().userUuid)
billCompleteViewModel.billCompltedModel.finishUser = finishModel billCompleteViewModel.billCompltedModel.finishUser = finishModel
billCompleteViewModel.billCompltedModel.store = billCompleteViewModel.billDetailModel.store
billCompleteViewModel.billCompltedModel.deviceadree = billCompleteViewModel.billDetailModel.deviceadree
billCompleteViewModel.billCompltedModel.reporterPhone = billCompleteViewModel.billDetailModel.reporterPhone
billCompleteViewModel.complteRepairOrderAction(billCompleteViewModel.billCompltedModel).subscribe(onNext: {[weak self] () in billCompleteViewModel.complteRepairOrderAction(billCompleteViewModel.billCompltedModel).subscribe(onNext: {[weak self] () in
self?.stateBlock(SUBMIT_REPAIR_ORDER_STATE.FINISHED.rawValue) self?.stateBlock(SUBMIT_REPAIR_ORDER_STATE.FINISHED.rawValue)
/// 延时一秒调用 /// 延时一秒调用
......
...@@ -100,12 +100,12 @@ class RepairOrderDetailBgController: BaseViewController { ...@@ -100,12 +100,12 @@ class RepairOrderDetailBgController: BaseViewController {
return return
} }
} }
let completeVc = RepairOrderCompletedViewController.instantiateViewController(.Function) as! RepairOrderCompletedViewController let completeVc = RepairOrderCompletedViewController.instantiateViewController(.Function) as! RepairOrderCompletedViewController
let model = BillCompletedRequestModel(fromJson: JSON(detailVc.orderDetailViewModel.billDetailModel.toDictionary())) let model = BillCompletedRequestModel(fromJson: JSON(detailVc.orderDetailViewModel.billDetailModel.toDictionary()))
completeVc.setStateBlock({[weak self] (state) in completeVc.setStateBlock({[weak self] (state) in
self?.rapairBillBottomViewAction(state) self?.rapairBillBottomViewAction(state)
}) })
completeVc.billCompleteViewModel.billDetailModel = detailVc.orderDetailViewModel.billDetailModel
completeVc.billCompleteViewModel.billCompltedModel = model completeVc.billCompleteViewModel.billCompltedModel = model
pushVC(completeVc) pushVC(completeVc)
} }
......
...@@ -228,6 +228,23 @@ class RepairOrderEditSonOrderViewController: BaseTableViewController { ...@@ -228,6 +228,23 @@ class RepairOrderEditSonOrderViewController: BaseTableViewController {
afterAttachmentVc.photoAttachmentCollectionView.reloadData() afterAttachmentVc.photoAttachmentCollectionView.reloadData()
return afterCell return afterCell
} }
if indexPath.section == CHILD_BILL_EDIT_SECTION.COST.rawValue {
if indexPath.row != kZERO {
let costCell = tableView.dequeueReusableCell(withIdentifier: CostOrBorrowTableViewCell.name(), for: indexPath) as! CostOrBorrowTableViewCell
let model = childBillViewModel.childBillDetailData.executeOutsources[indexPath.row - kONE]
costCell.updateCell(model, indexPath)
return costCell
}
}
if indexPath.section == CHILD_BILL_EDIT_SECTION.BORROW.rawValue {
if indexPath.row != kZERO {
let brrowCell = tableView.dequeueReusableCell(withIdentifier: CostOrBorrowTableViewCell.name(), for: indexPath) as! CostOrBorrowTableViewCell
let model = childBillViewModel.childBillDetailData.executeMateriels[indexPath.row - kONE]
brrowCell.updateCell(model, indexPath)
return brrowCell
}
}
return super.tableView(tableView, cellForRowAt: indexPath) return super.tableView(tableView, cellForRowAt: indexPath)
} }
...@@ -244,12 +261,12 @@ class RepairOrderEditSonOrderViewController: BaseTableViewController { ...@@ -244,12 +261,12 @@ class RepairOrderEditSonOrderViewController: BaseTableViewController {
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
switch section { switch section {
case CHILD_BILL_DETAIL_SECTION.COST.rawValue: case CHILD_BILL_EDIT_SECTION.COST.rawValue:
if childBillViewModel.childBillDetailData.executeOutsources == nil { if childBillViewModel.childBillDetailData.executeOutsources == nil {
return kONE return kONE
} }
return childBillViewModel.childBillDetailData.executeOutsources.count + kONE return childBillViewModel.childBillDetailData.executeOutsources.count + kONE
case CHILD_BILL_DETAIL_SECTION.BORROW.rawValue: case CHILD_BILL_EDIT_SECTION.BORROW.rawValue:
if childBillViewModel.childBillDetailData.executeMateriels == nil { if childBillViewModel.childBillDetailData.executeMateriels == nil {
return kONE return kONE
} }
...@@ -260,6 +277,18 @@ class RepairOrderEditSonOrderViewController: BaseTableViewController { ...@@ -260,6 +277,18 @@ class RepairOrderEditSonOrderViewController: BaseTableViewController {
return super.tableView(tableView, numberOfRowsInSection: section) return super.tableView(tableView, numberOfRowsInSection: section)
} }
//cell的缩进级别,动态静态cell必须重写,否则会造成崩溃
override func tableView(_ tableView: UITableView, indentationLevelForRowAt indexPath: IndexPath) -> Int {
switch indexPath.section {
case CHILD_BILL_EDIT_SECTION.COST.rawValue:
return super.tableView(tableView, indentationLevelForRowAt: IndexPath(row: 0, section: CHILD_BILL_EDIT_SECTION.COST.rawValue))
case CHILD_BILL_EDIT_SECTION.BORROW.rawValue:
return super.tableView(tableView, indentationLevelForRowAt: IndexPath(row: 0, section: CHILD_BILL_EDIT_SECTION.BORROW.rawValue))
default:
break
}
return super.tableView(tableView, indentationLevelForRowAt: indexPath)
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section == CHILD_BILL_EDIT_SECTION.BEFORATTACHMENT.rawValue { if indexPath.section == CHILD_BILL_EDIT_SECTION.BEFORATTACHMENT.rawValue {
...@@ -268,10 +297,37 @@ class RepairOrderEditSonOrderViewController: BaseTableViewController { ...@@ -268,10 +297,37 @@ class RepairOrderEditSonOrderViewController: BaseTableViewController {
if indexPath.section == CHILD_BILL_EDIT_SECTION.AFTERATTACHMENT.rawValue { if indexPath.section == CHILD_BILL_EDIT_SECTION.AFTERATTACHMENT.rawValue {
return afterAttachmentHeight + 20 return afterAttachmentHeight + 20
} }
if indexPath.section == CHILD_BILL_EDIT_SECTION.COST.rawValue || indexPath.section == CHILD_BILL_EDIT_SECTION.BORROW.rawValue {
if indexPath.row == kZERO {
return 30
}
return kCellHeight
}
return super.tableView(tableView, heightForRowAt: indexPath) return super.tableView(tableView, heightForRowAt: indexPath)
} }
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
switch indexPath.section {
case CHILD_BILL_EDIT_SECTION.COST.rawValue:
if indexPath.row == kZERO {
return
}
let costVc = ChildBillDetailCostViewController.instantiateViewController(.Function) as! ChildBillDetailCostViewController
costVc.costModel = childBillViewModel.childBillDetailData.executeOutsources[indexPath.row - kONE]
pushVC(costVc)
break
case CHILD_BILL_EDIT_SECTION.BORROW.rawValue:
if indexPath.row == kZERO {
return
}
let borrowVc = ChildBillDetailBorrowViewController.instantiateViewController(.Function) as! ChildBillDetailBorrowViewController
borrowVc.borrowModel = childBillViewModel.childBillDetailData.executeMateriels[indexPath.row - kONE]
pushVC(borrowVc)
break
default:
break
}
childBillViewModel.didSelectRowAtIndexPath(indexPath, self) childBillViewModel.didSelectRowAtIndexPath(indexPath, self)
} }
} }
......
...@@ -13,15 +13,18 @@ open class BillCompletedRequestModel : NSObject{ ...@@ -13,15 +13,18 @@ open class BillCompletedRequestModel : NSObject{
var brokenTime : String! var brokenTime : String!
var descriptionField : String! var descriptionField : String!
var device : UCN! var device : UCN!
var deviceadree: String!
var finish : Bool! var finish : Bool!
var finishNote : String! var finishNote : String!
var finishTime : String! var finishTime : String!
var finishUser : UCN! var finishUser : UCN!
var level : String! var level : String!
var position : UCN! var locationAttachmentId: String!
var store : UCN!
var receiveTime : String! var receiveTime : String!
var reportUser : UCN! var reportUser : UCN!
var requestTime : String! var requestTime : String!
var reporterPhone: String!
var serviceType : String! var serviceType : String!
var source : String! var source : String!
var state : String! var state : String!
...@@ -53,13 +56,16 @@ open class BillCompletedRequestModel : NSObject{ ...@@ -53,13 +56,16 @@ open class BillCompletedRequestModel : NSObject{
level = json["level"].stringValue level = json["level"].stringValue
let positionJson = json["position"] let positionJson = json["position"]
if !positionJson.isEmpty{ if !positionJson.isEmpty{
position = UCN(fromJson: positionJson) store = UCN(fromJson: positionJson)
} }
receiveTime = json["receiveTime"].stringValue receiveTime = json["receiveTime"].stringValue
let reportUserJson = json["reportUser"] let reportUserJson = json["reportUser"]
if !reportUserJson.isEmpty{ if !reportUserJson.isEmpty{
reportUser = UCN(fromJson: reportUserJson) reportUser = UCN(fromJson: reportUserJson)
} }
deviceadree = json["reporterPhone"].stringValue
locationAttachmentId = json["locationAttachmentId"].stringValue
reporterPhone = json["reporterPhone"].stringValue
requestTime = json["requestTime"].stringValue requestTime = json["requestTime"].stringValue
serviceType = json["serviceType"].stringValue serviceType = json["serviceType"].stringValue
source = json["source"].stringValue source = json["source"].stringValue
...@@ -69,6 +75,7 @@ open class BillCompletedRequestModel : NSObject{ ...@@ -69,6 +75,7 @@ open class BillCompletedRequestModel : NSObject{
workNo = json["workNo"].stringValue workNo = json["workNo"].stringValue
} }
/** /**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property * Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/ */
...@@ -81,6 +88,12 @@ open class BillCompletedRequestModel : NSObject{ ...@@ -81,6 +88,12 @@ open class BillCompletedRequestModel : NSObject{
if descriptionField != nil{ if descriptionField != nil{
dictionary["description"] = descriptionField dictionary["description"] = descriptionField
} }
if locationAttachmentId != nil {
dictionary["locationAttachmentId"] = locationAttachmentId
}
if reporterPhone != nil {
dictionary["reporterPhone"] = reporterPhone
}
if device != nil{ if device != nil{
dictionary["device"] = device.toDictionary() dictionary["device"] = device.toDictionary()
} }
...@@ -99,8 +112,8 @@ open class BillCompletedRequestModel : NSObject{ ...@@ -99,8 +112,8 @@ open class BillCompletedRequestModel : NSObject{
if level != nil{ if level != nil{
dictionary["level"] = level dictionary["level"] = level
} }
if position != nil{ if store != nil{
dictionary["position"] = position.toDictionary() dictionary["store"] = store.toDictionary()
} }
if receiveTime != nil{ if receiveTime != nil{
dictionary["receiveTime"] = receiveTime dictionary["receiveTime"] = receiveTime
...@@ -114,6 +127,9 @@ open class BillCompletedRequestModel : NSObject{ ...@@ -114,6 +127,9 @@ open class BillCompletedRequestModel : NSObject{
if serviceType != nil{ if serviceType != nil{
dictionary["serviceType"] = serviceType dictionary["serviceType"] = serviceType
} }
if deviceadree != nil{
dictionary["deviceadree"] = deviceadree
}
if source != nil{ if source != nil{
dictionary["source"] = source dictionary["source"] = source
} }
......
...@@ -109,12 +109,11 @@ open class ChildBillDetailData : NSObject{ ...@@ -109,12 +109,11 @@ open class ChildBillDetailData : NSObject{
let executeMaterielsArray = json["executeMateriels"].arrayValue let executeMaterielsArray = json["executeMateriels"].arrayValue
for executeMaterielsJson in executeMaterielsArray{ for executeMaterielsJson in executeMaterielsArray{
let value = ExecuteMateriel(fromJson: executeMaterielsJson) let value = ExecuteMateriel(fromJson: executeMaterielsJson)
executeMateriels.append(value) if value.sourceType == CHILDORDERCOST_TYPE.COST.rawValue {
} executeOutsources.append(value)
let executeOutsourcesArray = json["executeOutsources"].arrayValue }else {
for executeMaterielsJson in executeOutsourcesArray{ executeMateriels.append(value)
let value = ExecuteMateriel(fromJson: executeMaterielsJson) }
executeOutsources.append(value)
} }
endAttachmentId = json["endAttachmentId"].stringValue endAttachmentId = json["endAttachmentId"].stringValue
executeNo = json["executeNo"].stringValue executeNo = json["executeNo"].stringValue
...@@ -247,7 +246,7 @@ open class ChildBillDetailData : NSObject{ ...@@ -247,7 +246,7 @@ open class ChildBillDetailData : NSObject{
class ExecuteMateriel : NSObject{ class ExecuteMateriel : NSObject{
var backQty : String! var backQty : Float!
var batchNo : String! var batchNo : String!
var createId : String! var createId : String!
var createOperName : String! var createOperName : String!
...@@ -262,7 +261,7 @@ class ExecuteMateriel : NSObject{ ...@@ -262,7 +261,7 @@ class ExecuteMateriel : NSObject{
var sourceId : String! var sourceId : String!
var sourceType : String! var sourceType : String!
var unitPrice : Float! var unitPrice : Float!
var useQty : Double! var useQty : Float!
var uuid : String! var uuid : String!
var version : Int! var version : Int!
var workexecuteid : String! var workexecuteid : String!
...@@ -275,7 +274,7 @@ class ExecuteMateriel : NSObject{ ...@@ -275,7 +274,7 @@ class ExecuteMateriel : NSObject{
if json.isEmpty{ if json.isEmpty{
return return
} }
backQty = json["backQty"].stringValue backQty = json["backQty"].floatValue
batchNo = json["batchNo"].stringValue batchNo = json["batchNo"].stringValue
createId = json["create_id"].stringValue createId = json["create_id"].stringValue
createOperName = json["create_operName"].stringValue createOperName = json["create_operName"].stringValue
...@@ -293,7 +292,7 @@ class ExecuteMateriel : NSObject{ ...@@ -293,7 +292,7 @@ class ExecuteMateriel : NSObject{
sourceId = json["sourceId"].stringValue sourceId = json["sourceId"].stringValue
sourceType = json["sourceType"].stringValue sourceType = json["sourceType"].stringValue
unitPrice = json["unitPrice"].floatValue unitPrice = json["unitPrice"].floatValue
useQty = json["useQty"].doubleValue useQty = json["useQty"].floatValue
uuid = json["uuid"].stringValue uuid = json["uuid"].stringValue
version = json["version"].intValue version = json["version"].intValue
workexecuteid = json["workexecuteid"].stringValue workexecuteid = json["workexecuteid"].stringValue
......
...@@ -16,6 +16,7 @@ class CostOrBorrowTableViewCell: UITableViewCell { ...@@ -16,6 +16,7 @@ class CostOrBorrowTableViewCell: UITableViewCell {
/// item 详情 /// item 详情
@IBOutlet weak var detailLabel: UILabel! @IBOutlet weak var detailLabel: UILabel!
override func awakeFromNib() { override func awakeFromNib() {
super.awakeFromNib() super.awakeFromNib()
} }
...@@ -28,7 +29,7 @@ class CostOrBorrowTableViewCell: UITableViewCell { ...@@ -28,7 +29,7 @@ class CostOrBorrowTableViewCell: UITableViewCell {
if model.sourceType == CHILDORDERCOST_TYPE.BORROW.rawValue { if model.sourceType == CHILDORDERCOST_TYPE.BORROW.rawValue {
detailLabel.text = model.outputbillno detailLabel.text = model.outputbillno
}else { }else {
detailLabel.text = String(format: "%.2f", model.getQty) detailLabel.text = String(format: "%.2f", model.unitPrice * model.useQty)
} }
} }
......
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