|
|
@@ -54,7 +54,7 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
intent.getStringExtra("operationtype")
|
|
|
}
|
|
|
|
|
|
- private val data : ContractData by lazy {
|
|
|
+ private val data: ContractData by lazy {
|
|
|
intent.getParcelableExtra<ContractData>("data") as ContractData
|
|
|
}
|
|
|
|
|
|
@@ -67,84 +67,121 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
* 标仓系数输入值
|
|
|
*/
|
|
|
lateinit var coefficientWarehouse: EditText
|
|
|
+
|
|
|
/** 商品规格 ***/
|
|
|
- lateinit var productSpecifications : EditText
|
|
|
+ lateinit var productSpecifications: EditText
|
|
|
+
|
|
|
/** 数量 **/
|
|
|
- private lateinit var number_Edittext : EditText
|
|
|
+ private lateinit var number_Edittext: EditText
|
|
|
+
|
|
|
/** 输入价格 **/
|
|
|
- private lateinit var price_edittext : EditText
|
|
|
+ private lateinit var price_edittext: EditText
|
|
|
+
|
|
|
/** 输入升贴水 **/
|
|
|
- private lateinit var liter_discount_edittext : EditText
|
|
|
+ private lateinit var liter_discount_edittext: EditText
|
|
|
+
|
|
|
/** 一口价时的金额输入 **/
|
|
|
- private lateinit var price_edittext_one : TextView
|
|
|
+ private lateinit var price_edittext_one: TextView
|
|
|
+
|
|
|
/** 输入暂定价 **/
|
|
|
- lateinit var temperary_edittext : EditText
|
|
|
+ lateinit var temperary_edittext: EditText
|
|
|
+
|
|
|
/** 保证金 **/
|
|
|
- lateinit var margin_edittext : EditText
|
|
|
+ lateinit var margin_edittext: EditText
|
|
|
+
|
|
|
/** 备注 **/
|
|
|
- lateinit var remask_edittext : EditText
|
|
|
+ lateinit var remask_edittext: EditText
|
|
|
+
|
|
|
/**
|
|
|
* 本页面选择的合同类型
|
|
|
*/
|
|
|
var contractType: MutableLiveData<SelectData> = MutableLiveData()
|
|
|
|
|
|
/** 选择的客户 */
|
|
|
- val selectCustomer : MutableLiveData<SelectData> = MutableLiveData()
|
|
|
+ val selectCustomer: MutableLiveData<SelectData> = MutableLiveData()
|
|
|
|
|
|
/** 选择的现货商品类型 */
|
|
|
- val selectWrStandardData : MutableLiveData<SelectData> = MutableLiveData()
|
|
|
+ val selectWrStandardData: MutableLiveData<SelectData> = MutableLiveData()
|
|
|
|
|
|
/** 选择的型号类型 **/
|
|
|
- val selectWrStandModel : MutableLiveData<SelectData> = MutableLiveData()
|
|
|
+ val selectWrStandModel: MutableLiveData<SelectData> = MutableLiveData()
|
|
|
|
|
|
/** 选择的品牌 ***/
|
|
|
- val selectWrStandBrand : MutableLiveData<SelectData> = MutableLiveData()
|
|
|
+ val selectWrStandBrand: MutableLiveData<SelectData> = MutableLiveData()
|
|
|
+
|
|
|
+ /** 点价,暂定价选的点价合约 **/
|
|
|
+ val selectGoodsList: MutableLiveData<SelectData> = MutableLiveData()
|
|
|
|
|
|
/**
|
|
|
* 产品类型
|
|
|
*/
|
|
|
val productType by lazy {
|
|
|
- arrayListOf(SelectData(MTPEnums.STANDARD_OF_THE_WAREHOUSE.toString(),"标准仓单"),
|
|
|
- SelectData(MTPEnums.SUCH_AS_THS.toString(),"等标"),
|
|
|
- SelectData(MTPEnums.NON_STANDARD.toString(),"非标")
|
|
|
+ arrayListOf(
|
|
|
+ SelectData(MTPEnums.STANDARD_OF_THE_WAREHOUSE.toString(), "标准仓单"),
|
|
|
+ SelectData(MTPEnums.SUCH_AS_THS.toString(), "等标"),
|
|
|
+ SelectData(MTPEnums.NON_STANDARD.toString(), "非标")
|
|
|
)
|
|
|
}
|
|
|
+
|
|
|
/** 选择的产品类型 **/
|
|
|
- val selectProductType : MutableLiveData<SelectData> = MutableLiveData()
|
|
|
+ val selectProductType: MutableLiveData<SelectData> = MutableLiveData()
|
|
|
|
|
|
/**
|
|
|
* 点价类型列表
|
|
|
*/
|
|
|
val priceType by lazy {
|
|
|
- arrayListOf(SelectData(MTPEnums.PRICE.toString(),"一口价"),
|
|
|
- SelectData(MTPEnums.SOME_PRICE.toString(),"点价"),
|
|
|
- SelectData(MTPEnums.TEMPORARY_PRICE.toString(),"暂定价")
|
|
|
+ arrayListOf(
|
|
|
+ SelectData(MTPEnums.PRICE.toString(), "一口价"),
|
|
|
+ SelectData(MTPEnums.SOME_PRICE.toString(), "点价"),
|
|
|
+ SelectData(MTPEnums.TEMPORARY_PRICE.toString(), "暂定价")
|
|
|
)
|
|
|
}
|
|
|
|
|
|
/** 点价期 **/
|
|
|
- val midpointsPeriodTime : MutableLiveData<String> = MutableLiveData()
|
|
|
+ val midpointsPeriodTime: MutableLiveData<String> = MutableLiveData()
|
|
|
|
|
|
/** 交收期 */
|
|
|
- val deliveryPeriodTime : MutableLiveData<String> = MutableLiveData()
|
|
|
-
|
|
|
- fun initData(){
|
|
|
- if (operationtype == "1"){//新增合同市需要初始化的数据
|
|
|
- contractType.postValue(SelectData(
|
|
|
- id = MTPEnums.CONTRACT_TYPE_BUY.toString(),
|
|
|
- value = "采购合同"
|
|
|
- ))//初始化一个合同类型
|
|
|
- viewModel.pricingType.postValue(SelectData(id = "1",value = "一口价"))//初始化一个价格类型
|
|
|
- }else{//修改或者重新提交时需要初始化的数据
|
|
|
- contractType.postValue(SelectData(id = data.contracttype.toString(),value = if (data.contracttype == "1"){
|
|
|
- "采购合同"
|
|
|
- }else{
|
|
|
- "销售合同"
|
|
|
- }))
|
|
|
- viewModel.pricingType.postValue(SelectData(id = data.pricetype.toString(),value = ViewEnumUtils.getPriceType(data.pricetype ?: "")))
|
|
|
- selectWrStandardData.postValue(SelectData(id = data.deliverygoodscode.toString(),value = data.deliverygoodsname.toString(),deliverygoodsid = data.deliverygoodsid.toString()))
|
|
|
+ val deliveryPeriodTime: MutableLiveData<String> = MutableLiveData()
|
|
|
+
|
|
|
+ fun initData() {
|
|
|
+ if (operationtype == "1") {//新增合同市需要初始化的数据
|
|
|
+ contractType.postValue(
|
|
|
+ SelectData(
|
|
|
+ id = MTPEnums.CONTRACT_TYPE_BUY.toString(),
|
|
|
+ value = "采购合同"
|
|
|
+ )
|
|
|
+ )//初始化一个合同类型
|
|
|
+ viewModel.pricingType.postValue(SelectData(id = "1", value = "一口价"))//初始化一个价格类型
|
|
|
+ } else {//修改或者重新提交时需要初始化的数据
|
|
|
+ contractType.postValue(
|
|
|
+ SelectData(
|
|
|
+ id = data.contracttype.toString(), value = if (data.contracttype == "1") {
|
|
|
+ "采购合同"
|
|
|
+ } else {
|
|
|
+ "销售合同"
|
|
|
+ }
|
|
|
+ )
|
|
|
+ )
|
|
|
+ viewModel.pricingType.postValue(
|
|
|
+ SelectData(
|
|
|
+ id = data.pricetype.toString(),
|
|
|
+ value = ViewEnumUtils.getPriceType(data.pricetype ?: "")
|
|
|
+ )
|
|
|
+ )
|
|
|
+ selectWrStandardData.postValue(
|
|
|
+ SelectData(
|
|
|
+ id = data.deliverygoodscode.toString(),
|
|
|
+ value = data.deliverygoodsname.toString(),
|
|
|
+ deliverygoodsid = data.deliverygoodsid.toString()
|
|
|
+ )
|
|
|
+ )
|
|
|
viewModel.queryWrStandardDetail(data.deliverygoodscode ?: "")
|
|
|
- selectProductType.postValue(SelectData(id = data.producttype.toString(),value = ViewEnumUtils.getProductType(data.producttype.toString())))
|
|
|
+ selectProductType.postValue(
|
|
|
+ SelectData(
|
|
|
+ id = data.producttype.toString(),
|
|
|
+ value = ViewEnumUtils.getProductType(data.producttype.toString())
|
|
|
+ )
|
|
|
+ )
|
|
|
|
|
|
// selectWrStandModel.postValue(SelectData(id = data.spotgoodsdesc.toString()))
|
|
|
}
|
|
|
@@ -153,7 +190,7 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
super.onCreate(savedInstanceState)
|
|
|
verticalLayout {
|
|
|
- createLoadingDialog(hintStr = "").bindTaskStatus(context,viewModel.loadingDialogStatus)
|
|
|
+ createLoadingDialog(hintStr = "").bindTaskStatus(context, viewModel.loadingDialogStatus)
|
|
|
background = resources.getDrawable(R.color.segtabment_bg_color)
|
|
|
viewModel.queryUserInfo()
|
|
|
viewModel.queryWrStandardList()
|
|
|
@@ -161,7 +198,7 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
topBar {
|
|
|
commonLeftButton()
|
|
|
commonTitle {
|
|
|
- text = "新增采购合同"
|
|
|
+ text = "新增合同"
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -267,7 +304,9 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
onThrottleFirstClick {
|
|
|
if (contractType.value?.id == "-1") {
|
|
|
- val selectDataList = viewModel.setSelectCustomerList(viewModel.normalUserInfoList.value ?: arrayListOf())
|
|
|
+ val selectDataList = viewModel.setSelectCustomerList(
|
|
|
+ viewModel.normalUserInfoList.value ?: arrayListOf()
|
|
|
+ )
|
|
|
creatBottomSheetDialog("请选择客户", selectDataList) {
|
|
|
selectCustomer.postValue(this)
|
|
|
}
|
|
|
@@ -308,8 +347,8 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- selectCustomer.bindOptional(context){
|
|
|
- if (contractType.value?.id == "-1"){
|
|
|
+ selectCustomer.bindOptional(context) {
|
|
|
+ if (contractType.value?.id == "-1") {
|
|
|
text = it?.value
|
|
|
}
|
|
|
|
|
|
@@ -342,7 +381,9 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
background = resources.getDrawable(R.color.white)
|
|
|
onThrottleFirstClick {
|
|
|
if (contractType.value?.id == "1") {
|
|
|
- val selectDataList = viewModel.setSelectCustomerList(viewModel.normalUserInfoList.value ?: arrayListOf())
|
|
|
+ val selectDataList = viewModel.setSelectCustomerList(
|
|
|
+ viewModel.normalUserInfoList.value ?: arrayListOf()
|
|
|
+ )
|
|
|
creatBottomSheetDialog("请选择客户", selectDataList) {
|
|
|
selectCustomer.postValue(this)
|
|
|
}
|
|
|
@@ -381,8 +422,8 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
"请选择客户"
|
|
|
}
|
|
|
}
|
|
|
- selectCustomer.bindOptional(context){
|
|
|
- if (contractType.value?.id == "1"){
|
|
|
+ selectCustomer.bindOptional(context) {
|
|
|
+ if (contractType.value?.id == "1") {
|
|
|
text = it?.value
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
}
|
|
|
@@ -502,7 +543,11 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
val path = imageString.value.guard {
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
- PhotoUtils().showImageViewer(this@AddContractActivity, 1, arrayListOf(path))
|
|
|
+ PhotoUtils().showImageViewer(
|
|
|
+ this@AddContractActivity,
|
|
|
+ 1,
|
|
|
+ arrayListOf(path)
|
|
|
+ )
|
|
|
}
|
|
|
textResource = R.string.check_the_attachment
|
|
|
textColorInt = R.color.rma_yellow_text_color
|
|
|
@@ -518,7 +563,12 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
background = resources.getDrawable(R.color.white)
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
onThrottleFirstClick {
|
|
|
- creatBottomSheetDialog("请选择现货品种", viewModel.selectSpotVarietiesList(viewModel.wrStandardDataList.value ?: arrayListOf())) {
|
|
|
+ creatBottomSheetDialog(
|
|
|
+ "请选择现货品种",
|
|
|
+ viewModel.selectSpotVarietiesList(
|
|
|
+ viewModel.wrStandardDataList.value ?: arrayListOf()
|
|
|
+ )
|
|
|
+ ) {
|
|
|
selectWrStandardData.postValue(this)
|
|
|
viewModel.queryWrStandardDetail(this.id)
|
|
|
}
|
|
|
@@ -540,7 +590,7 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
}
|
|
|
|
|
|
textView {
|
|
|
- selectWrStandardData.bindOptional(context){
|
|
|
+ selectWrStandardData.bindOptional(context) {
|
|
|
text = it?.value
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
}
|
|
|
@@ -587,7 +637,7 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
}
|
|
|
|
|
|
textView {
|
|
|
- selectProductType.bindOptional(context){
|
|
|
+ selectProductType.bindOptional(context) {
|
|
|
text = it?.value
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
}
|
|
|
@@ -631,7 +681,7 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
editText {
|
|
|
|
|
|
coefficientWarehouse = this
|
|
|
- if (data.convertfactor?.isNotEmpty() == true){
|
|
|
+ if (data.convertfactor?.isNotEmpty() == true) {
|
|
|
coefficientWarehouse.setText(data.convertfactor.toString())
|
|
|
}
|
|
|
hint = "请输入标仓系数"
|
|
|
@@ -681,7 +731,7 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
}
|
|
|
|
|
|
textView {
|
|
|
- selectWrStandModel.bindOptional(context){
|
|
|
+ selectWrStandModel.bindOptional(context) {
|
|
|
text = it?.value
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
}
|
|
|
@@ -736,7 +786,7 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
}
|
|
|
|
|
|
textView {
|
|
|
- selectWrStandBrand.bindOptional(context){
|
|
|
+ selectWrStandBrand.bindOptional(context) {
|
|
|
text = it?.value
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
}
|
|
|
@@ -779,6 +829,11 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
|
|
|
editText {
|
|
|
productSpecifications = this
|
|
|
+ selectWrStandardData.bindOptional(context){
|
|
|
+ if (it?.id?.isNotEmpty() == true){
|
|
|
+ setText("默认")
|
|
|
+ }
|
|
|
+ }
|
|
|
hint = "请输入商品规格"
|
|
|
background = null
|
|
|
inputType = EditorInfo.TYPE_CLASS_TEXT
|
|
|
@@ -860,14 +915,17 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
editText {
|
|
|
textChangedListener {
|
|
|
afterTextChanged {
|
|
|
- if (it.toString().isNotEmpty()){
|
|
|
- if (price_edittext.text.toString().isNotEmpty()){
|
|
|
- price_edittext_one.text = price_edittext.text.toString().toDouble().times(number_Edittext.text.toString().toDouble()).toString()
|
|
|
+ if (it.toString().isNotEmpty()) {
|
|
|
+ if (price_edittext.text.toString().isNotEmpty()) {
|
|
|
+ price_edittext_one.text =
|
|
|
+ price_edittext.text.toString().toDouble().times(
|
|
|
+ number_Edittext.text.toString().toDouble()
|
|
|
+ ).toString()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (operationtype == "2"){
|
|
|
+ if (operationtype == "2") {
|
|
|
setText(data.qty)
|
|
|
}
|
|
|
number_Edittext = this
|
|
|
@@ -883,7 +941,7 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
}
|
|
|
|
|
|
textView {
|
|
|
- selectWrStandardData.bindOptional(context){
|
|
|
+ selectWrStandardData.bindOptional(context) {
|
|
|
text = it?.enumdicname
|
|
|
}
|
|
|
textSizeAuto = 31
|
|
|
@@ -924,15 +982,18 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
editText {
|
|
|
textChangedListener {
|
|
|
afterTextChanged {
|
|
|
- if (it.toString().isNotEmpty()){
|
|
|
- if (number_Edittext.text.toString().isNotEmpty()){
|
|
|
- price_edittext_one.text = price_edittext.text.toString().toDouble().times(number_Edittext.text.toString().toDouble()).toString()
|
|
|
+ if (it.toString().isNotEmpty()) {
|
|
|
+ if (number_Edittext.text.toString().isNotEmpty()) {
|
|
|
+ price_edittext_one.text =
|
|
|
+ price_edittext.text.toString().toDouble().times(
|
|
|
+ number_Edittext.text.toString().toDouble()
|
|
|
+ ).toString()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
price_edittext = this
|
|
|
- if (operationtype == "2"){
|
|
|
+ if (operationtype == "2") {
|
|
|
data.price.let {
|
|
|
setText(it)
|
|
|
}
|
|
|
@@ -982,7 +1043,7 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
textSizeAuto = 31
|
|
|
text = "0"
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginStart = autoSize(80)
|
|
|
}
|
|
|
|
|
|
@@ -1050,6 +1111,14 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
|
|
|
linearLayout {
|
|
|
background = resources.getDrawable(R.color.white)
|
|
|
+ onThrottleFirstClick {
|
|
|
+
|
|
|
+ val selectDataList = viewModel.setSelectGoodsList()
|
|
|
+ creatBottomSheetDialog("请选择客户", selectDataList) {
|
|
|
+ selectGoodsList.postValue(this)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
viewModel.pricingType.bindOptional(context) {
|
|
|
if (it?.id == "1") {
|
|
|
visibility = View.GONE
|
|
|
@@ -1076,6 +1145,10 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
}
|
|
|
|
|
|
textView {
|
|
|
+ selectGoodsList.bindOptional(context) {
|
|
|
+ text = it?.value
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }
|
|
|
text = "请选择点价合约"
|
|
|
textSizeAuto = 31
|
|
|
textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
@@ -1173,7 +1246,7 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
}
|
|
|
|
|
|
textView {
|
|
|
- midpointsPeriodTime.bindOptional(context){
|
|
|
+ midpointsPeriodTime.bindOptional(context) {
|
|
|
text = it
|
|
|
}
|
|
|
text = "请选择点价期"
|
|
|
@@ -1216,7 +1289,7 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
}
|
|
|
|
|
|
textView {
|
|
|
- deliveryPeriodTime.bindOptional(context){
|
|
|
+ deliveryPeriodTime.bindOptional(context) {
|
|
|
text = it
|
|
|
}
|
|
|
text = "请选择交收期"
|
|
|
@@ -1256,7 +1329,7 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
hintColorStr = "#CCCCCC"
|
|
|
textSizeAuto = 31
|
|
|
textColorStr = "#333333"
|
|
|
- }.lparams(matchParent, autoSize(132)) {
|
|
|
+ }.lparams(0, autoSize(132),1f) {
|
|
|
marginStart = autoSize(80)
|
|
|
}
|
|
|
|
|
|
@@ -1284,7 +1357,7 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
|
|
|
editText {
|
|
|
remask_edittext = this
|
|
|
- if (operationtype == "2"){
|
|
|
+ if (operationtype == "2") {
|
|
|
setText(data.remark)
|
|
|
}
|
|
|
hint = "请输入备注"
|
|
|
@@ -1317,10 +1390,14 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
|
|
|
textView {
|
|
|
onThrottleFirstClick {
|
|
|
- if (checkUpdate().not()){
|
|
|
+ if (checkUpdate().not()) {
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
- viewModel.orderContract(contractInfo = getContractInfo(),OperateType = "2",Remark = remask_edittext.text.toString()){
|
|
|
+ viewModel.orderContract(
|
|
|
+ contractInfo = getContractInfo(),
|
|
|
+ OperateType = "2",
|
|
|
+ Remark = remask_edittext.text.toString()
|
|
|
+ ) {
|
|
|
finish()
|
|
|
}
|
|
|
}
|
|
|
@@ -1339,18 +1416,18 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private fun getContractInfo() : SpotContractInfo{
|
|
|
+ private fun getContractInfo(): SpotContractInfo {
|
|
|
val contractInfo = SpotContractInfo()
|
|
|
val userid = GlobalDataCollection.instance?.loginRsp?.userID ?: 0
|
|
|
- if (contractNo.text.toString().isNotEmpty()){
|
|
|
+ if (contractNo.text.toString().isNotEmpty()) {
|
|
|
contractInfo.ContractNo = contractNo.text.toString()
|
|
|
}
|
|
|
contractInfo.ContractType = contractType.value?.id?.toInt()!!
|
|
|
contractInfo.UserID = userid
|
|
|
- if (contractType.value?.id == "1"){//采购合同
|
|
|
+ if (contractType.value?.id == "1") {//采购合同
|
|
|
contractInfo.BuyUserID = userid
|
|
|
contractInfo.SellUserID = selectCustomer.value?.id?.toInt()!!
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
contractInfo.BuyUserID = selectCustomer.value?.id?.toInt()!!
|
|
|
contractInfo.SellUserID = userid
|
|
|
}
|
|
|
@@ -1358,7 +1435,7 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
if (uploadFile.isNotEmpty()) {
|
|
|
contractInfo.ContractAttachment = uploadFile
|
|
|
}
|
|
|
- if (margin_edittext.text.toString().isNotEmpty()){
|
|
|
+ if (margin_edittext.text.toString().isNotEmpty()) {
|
|
|
contractInfo.ContractMargin = margin_edittext.text.toString().toDouble()
|
|
|
}
|
|
|
contractInfo.DeliveryGoodsID = selectWrStandardData.value?.deliverygoodsid?.toInt()!!
|
|
|
@@ -1371,26 +1448,27 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
contractInfo.Qty = number_Edittext.text.toString().toDouble()
|
|
|
|
|
|
|
|
|
- if (viewModel.pricingType.value?.id == "1"){//一口价时price为价格
|
|
|
+ if (viewModel.pricingType.value?.id == "1") {//一口价时price为价格
|
|
|
contractInfo.Price = price_edittext.text.toString().toDouble()
|
|
|
- contractInfo.Amount = price_edittext.text.toString().toDouble().times(number_Edittext.text.toString().toDouble())
|
|
|
- }else if (viewModel.pricingType.value?.id == "3"){//暂定价时price为暂定价
|
|
|
+ contractInfo.Amount = price_edittext.text.toString().toDouble()
|
|
|
+ .times(number_Edittext.text.toString().toDouble())
|
|
|
+ } else if (viewModel.pricingType.value?.id == "3") {//暂定价时price为暂定价
|
|
|
contractInfo.Price = temperary_edittext.text.toString().toDouble()
|
|
|
- contractInfo.GoodsID = 1025//暂时写死一个//点价合约在点价和暂定价是需要传值
|
|
|
- }else{
|
|
|
- contractInfo.GoodsID = 1025//暂时写死一个
|
|
|
+ contractInfo.GoodsID = selectGoodsList.value?.id?.toInt() ?: 0//点价合约在点价和暂定价是需要传值
|
|
|
+ } else {
|
|
|
+ contractInfo.GoodsID = selectGoodsList.value?.id?.toInt() ?: 0//暂时写死一个
|
|
|
}
|
|
|
- if (midpointsPeriodTime.value?.isNotEmpty() == true){//有点价时间
|
|
|
+ if (midpointsPeriodTime.value?.isNotEmpty() == true) {//有点价时间
|
|
|
contractInfo.StartDate = midpointsPeriodTime.value!!.split("~").get(0)
|
|
|
contractInfo.EndDate = midpointsPeriodTime.value!!.split("~").get(1)
|
|
|
}
|
|
|
|
|
|
- if (deliveryPeriodTime.value?.isNotEmpty() == true){//有交收时间
|
|
|
+ if (deliveryPeriodTime.value?.isNotEmpty() == true) {//有交收时间
|
|
|
contractInfo.DeliveryStartDate = deliveryPeriodTime.value!!.split("~").get(0)
|
|
|
contractInfo.DeliveryEndDate = deliveryPeriodTime.value!!.split("~").get(1)
|
|
|
}
|
|
|
|
|
|
- if (viewModel.pricingType.value?.id != "1"){
|
|
|
+ if (viewModel.pricingType.value?.id != "1") {
|
|
|
contractInfo.PriceMove = liter_discount_edittext.text.toString().toDouble()
|
|
|
}
|
|
|
//商品规格
|
|
|
@@ -1398,68 +1476,75 @@ class AddContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
return contractInfo
|
|
|
}
|
|
|
|
|
|
- private fun checkUpdate() : Boolean{
|
|
|
- if (contractNo.text.toString().isNullOrEmpty()){
|
|
|
+ private fun checkUpdate(): Boolean {
|
|
|
+ if (contractNo.text.toString().isNullOrEmpty()) {
|
|
|
ToastUtils.showLong("请输入合同编号")
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
- if (selectCustomer.value?.id.isNullOrEmpty()){
|
|
|
+ if (selectCustomer.value?.id.isNullOrEmpty()) {
|
|
|
ToastUtils.showLong("请选择客户")
|
|
|
return false
|
|
|
}
|
|
|
- if (selectWrStandardData.value?.id.isNullOrEmpty()){
|
|
|
+ if (selectWrStandardData.value?.id.isNullOrEmpty()) {
|
|
|
ToastUtils.showLong("请选择现货品种")
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
- if (selectProductType.value?.id.isNullOrEmpty()){
|
|
|
+ if (selectProductType.value?.id.isNullOrEmpty()) {
|
|
|
ToastUtils.showLong("请选择产品类型")
|
|
|
return false
|
|
|
}
|
|
|
- if (coefficientWarehouse.text.toString().isNullOrEmpty()){
|
|
|
+ if (coefficientWarehouse.text.toString().isNullOrEmpty()) {
|
|
|
ToastUtils.showLong("请输入标仓系数")
|
|
|
return false
|
|
|
}
|
|
|
- if (selectWrStandModel.value?.id.isNullOrEmpty()){
|
|
|
+ if (selectWrStandModel.value?.id.isNullOrEmpty()) {
|
|
|
ToastUtils.showLong("请选择型号")
|
|
|
return false
|
|
|
}
|
|
|
- if (selectWrStandBrand.value?.id.isNullOrEmpty()){
|
|
|
+ if (selectWrStandBrand.value?.id.isNullOrEmpty()) {
|
|
|
ToastUtils.showLong("请选择品牌")
|
|
|
return false
|
|
|
}
|
|
|
- if (productSpecifications.text.toString().isNullOrEmpty()){
|
|
|
+ if (productSpecifications.text.toString().isNullOrEmpty()) {
|
|
|
ToastUtils.showLong("请输入商品规格")
|
|
|
return false
|
|
|
}
|
|
|
- if (number_Edittext.text.toString().isNullOrEmpty()){
|
|
|
+ if (number_Edittext.text.toString().isNullOrEmpty()) {
|
|
|
ToastUtils.showLong("请输入数量")
|
|
|
return false
|
|
|
}
|
|
|
- if (viewModel.pricingType.value?.id == "1"){//判断一口价时需要输入的参数
|
|
|
- if (price_edittext.text.toString().isNullOrEmpty()){
|
|
|
+ if (viewModel.pricingType.value?.id == "1") {//判断一口价时需要输入的参数
|
|
|
+ if (price_edittext.text.toString().isNullOrEmpty()) {
|
|
|
ToastUtils.showLong("请输入价格")
|
|
|
return false
|
|
|
}
|
|
|
- if (price_edittext_one.text.toString().isNullOrEmpty()){
|
|
|
+ if (price_edittext_one.text.toString().isNullOrEmpty()) {
|
|
|
ToastUtils.showLong("请输入金额")
|
|
|
return false
|
|
|
}
|
|
|
- }else if (viewModel.pricingType.value?.id == "2"){//判断点价时需要输入的参数
|
|
|
- // TODO 添加判断点价合约
|
|
|
+ } else if (viewModel.pricingType.value?.id == "2") {//判断点价时需要输入的参数
|
|
|
+ if (selectGoodsList.value?.id.isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请选择点价合约")
|
|
|
+ return false
|
|
|
+ }
|
|
|
|
|
|
- if (liter_discount_edittext.text.toString().isNullOrEmpty()){
|
|
|
+ if (liter_discount_edittext.text.toString().isNullOrEmpty()) {
|
|
|
ToastUtils.showLong("升贴水")
|
|
|
return false
|
|
|
}
|
|
|
- }else if (viewModel.pricingType.value?.id == "3"){//判断暂定价时需要输入的参数
|
|
|
- // TODO 添加判断点价合约
|
|
|
- if (temperary_edittext.text.toString().isNullOrEmpty()){
|
|
|
+ } else if (viewModel.pricingType.value?.id == "3") {//判断暂定价时需要输入的参数
|
|
|
+ if (selectGoodsList.value?.id.isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请选择点价合约")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if (temperary_edittext.text.toString().isNullOrEmpty()) {
|
|
|
ToastUtils.showLong("请输入暂定价")
|
|
|
return false
|
|
|
}
|
|
|
- if (liter_discount_edittext.text.toString().isNullOrEmpty()){
|
|
|
+ if (liter_discount_edittext.text.toString().isNullOrEmpty()) {
|
|
|
ToastUtils.showLong("升贴水")
|
|
|
return false
|
|
|
}
|