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

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

parent d693d5c8
......@@ -35,10 +35,10 @@ class ChildBillDetailCostViewController: BaseTableViewController {
fileprivate func setupDataAction() {
logisticsLabel.text = costModel.materiel.name
priceLabel.text = String(format: "%.2f", costModel.unitPrice)
countLabel.text = String(format: "%.2f", costModel.getQty)
totalPriceLabel.text = String(format: "%.2f", costModel.getQty * costModel.unitPrice)
extractCountLabel.text = String(format: "%.0f", costModel.getQty)
returnCountLabel.text = String(format: "%.0f", costModel.useQty)
countLabel.text = String(format: "%.2f", costModel.useQty)
totalPriceLabel.text = String(format: "%.2f", costModel.unitPrice * costModel.useQty)
extractCountLabel.text = String(format: "%.2f", costModel.getQty)
returnCountLabel.text = String(format: "%.2f", costModel.backQty)
}
override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
......
......@@ -57,6 +57,9 @@ class RepairOrderCompletedViewController: BaseTableViewController {
billCompleteViewModel.billCompltedModel.finishTime = NSDate().httpParameterString()
let finishModel = UCN(kUser().userCode, kUser().userName, kUser().userUuid)
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
self?.stateBlock(SUBMIT_REPAIR_ORDER_STATE.FINISHED.rawValue)
/// 延时一秒调用
......
......@@ -100,12 +100,12 @@ class RepairOrderDetailBgController: BaseViewController {
return
}
}
let completeVc = RepairOrderCompletedViewController.instantiateViewController(.Function) as! RepairOrderCompletedViewController
let model = BillCompletedRequestModel(fromJson: JSON(detailVc.orderDetailViewModel.billDetailModel.toDictionary()))
completeVc.setStateBlock({[weak self] (state) in
self?.rapairBillBottomViewAction(state)
})
completeVc.billCompleteViewModel.billDetailModel = detailVc.orderDetailViewModel.billDetailModel
completeVc.billCompleteViewModel.billCompltedModel = model
pushVC(completeVc)
}
......
......@@ -228,6 +228,23 @@ class RepairOrderEditSonOrderViewController: BaseTableViewController {
afterAttachmentVc.photoAttachmentCollectionView.reloadData()
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)
}
......@@ -244,12 +261,12 @@ class RepairOrderEditSonOrderViewController: BaseTableViewController {
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
switch section {
case CHILD_BILL_DETAIL_SECTION.COST.rawValue:
case CHILD_BILL_EDIT_SECTION.COST.rawValue:
if childBillViewModel.childBillDetailData.executeOutsources == nil {
return 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 {
return kONE
}
......@@ -260,6 +277,18 @@ class RepairOrderEditSonOrderViewController: BaseTableViewController {
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 {
if indexPath.section == CHILD_BILL_EDIT_SECTION.BEFORATTACHMENT.rawValue {
......@@ -268,10 +297,37 @@ class RepairOrderEditSonOrderViewController: BaseTableViewController {
if indexPath.section == CHILD_BILL_EDIT_SECTION.AFTERATTACHMENT.rawValue {
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)
}
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)
}
}
......
......@@ -13,15 +13,18 @@ open class BillCompletedRequestModel : NSObject{
var brokenTime : String!
var descriptionField : String!
var device : UCN!
var deviceadree: String!
var finish : Bool!
var finishNote : String!
var finishTime : String!
var finishUser : UCN!
var level : String!
var position : UCN!
var locationAttachmentId: String!
var store : UCN!
var receiveTime : String!
var reportUser : UCN!
var requestTime : String!
var reporterPhone: String!
var serviceType : String!
var source : String!
var state : String!
......@@ -53,13 +56,16 @@ open class BillCompletedRequestModel : NSObject{
level = json["level"].stringValue
let positionJson = json["position"]
if !positionJson.isEmpty{
position = UCN(fromJson: positionJson)
store = UCN(fromJson: positionJson)
}
receiveTime = json["receiveTime"].stringValue
let reportUserJson = json["reportUser"]
if !reportUserJson.isEmpty{
reportUser = UCN(fromJson: reportUserJson)
}
deviceadree = json["reporterPhone"].stringValue
locationAttachmentId = json["locationAttachmentId"].stringValue
reporterPhone = json["reporterPhone"].stringValue
requestTime = json["requestTime"].stringValue
serviceType = json["serviceType"].stringValue
source = json["source"].stringValue
......@@ -69,6 +75,7 @@ open class BillCompletedRequestModel : NSObject{
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
*/
......@@ -81,6 +88,12 @@ open class BillCompletedRequestModel : NSObject{
if descriptionField != nil{
dictionary["description"] = descriptionField
}
if locationAttachmentId != nil {
dictionary["locationAttachmentId"] = locationAttachmentId
}
if reporterPhone != nil {
dictionary["reporterPhone"] = reporterPhone
}
if device != nil{
dictionary["device"] = device.toDictionary()
}
......@@ -99,8 +112,8 @@ open class BillCompletedRequestModel : NSObject{
if level != nil{
dictionary["level"] = level
}
if position != nil{
dictionary["position"] = position.toDictionary()
if store != nil{
dictionary["store"] = store.toDictionary()
}
if receiveTime != nil{
dictionary["receiveTime"] = receiveTime
......@@ -114,6 +127,9 @@ open class BillCompletedRequestModel : NSObject{
if serviceType != nil{
dictionary["serviceType"] = serviceType
}
if deviceadree != nil{
dictionary["deviceadree"] = deviceadree
}
if source != nil{
dictionary["source"] = source
}
......
......@@ -109,12 +109,11 @@ open class ChildBillDetailData : NSObject{
let executeMaterielsArray = json["executeMateriels"].arrayValue
for executeMaterielsJson in executeMaterielsArray{
let value = ExecuteMateriel(fromJson: executeMaterielsJson)
executeMateriels.append(value)
}
let executeOutsourcesArray = json["executeOutsources"].arrayValue
for executeMaterielsJson in executeOutsourcesArray{
let value = ExecuteMateriel(fromJson: executeMaterielsJson)
executeOutsources.append(value)
if value.sourceType == CHILDORDERCOST_TYPE.COST.rawValue {
executeOutsources.append(value)
}else {
executeMateriels.append(value)
}
}
endAttachmentId = json["endAttachmentId"].stringValue
executeNo = json["executeNo"].stringValue
......@@ -247,7 +246,7 @@ open class ChildBillDetailData : NSObject{
class ExecuteMateriel : NSObject{
var backQty : String!
var backQty : Float!
var batchNo : String!
var createId : String!
var createOperName : String!
......@@ -262,7 +261,7 @@ class ExecuteMateriel : NSObject{
var sourceId : String!
var sourceType : String!
var unitPrice : Float!
var useQty : Double!
var useQty : Float!
var uuid : String!
var version : Int!
var workexecuteid : String!
......@@ -275,7 +274,7 @@ class ExecuteMateriel : NSObject{
if json.isEmpty{
return
}
backQty = json["backQty"].stringValue
backQty = json["backQty"].floatValue
batchNo = json["batchNo"].stringValue
createId = json["create_id"].stringValue
createOperName = json["create_operName"].stringValue
......@@ -293,7 +292,7 @@ class ExecuteMateriel : NSObject{
sourceId = json["sourceId"].stringValue
sourceType = json["sourceType"].stringValue
unitPrice = json["unitPrice"].floatValue
useQty = json["useQty"].doubleValue
useQty = json["useQty"].floatValue
uuid = json["uuid"].stringValue
version = json["version"].intValue
workexecuteid = json["workexecuteid"].stringValue
......
......@@ -16,6 +16,7 @@ class CostOrBorrowTableViewCell: UITableViewCell {
/// item 详情
@IBOutlet weak var detailLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
}
......@@ -28,7 +29,7 @@ class CostOrBorrowTableViewCell: UITableViewCell {
if model.sourceType == CHILDORDERCOST_TYPE.BORROW.rawValue {
detailLabel.text = model.outputbillno
}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