diff --git a/models/pln/ToyotaCalloff.model.go b/models/pln/ToyotaCalloff.model.go index b664f59..52966e4 100644 --- a/models/pln/ToyotaCalloff.model.go +++ b/models/pln/ToyotaCalloff.model.go @@ -20,28 +20,29 @@ import ( * ******************************************************************************/ type ToyotaCalloff struct { - PlantNr int `xorm:"pk int 'PlantNr'" json:"PLN_ToyotaCalloff-PlantNr"` - DemandId string `xorm:"pk nvarchar(40) 'DemandId'" json:"PLN_ToyotaCalloff-DemandId"` - SupplierCode string `xorm:"nvarchar(40) 'SupplierCode' not null" json:"PLN_ToyotaCalloff-SupplierCode"` - ProjectId string `xorm:"nvarchar(40) 'ProjectId' not null" json:"PLN_ToyotaCalloff-ProjectId"` - ProductFamilyId string `xorm:"nvarchar(40) 'ProductFamilyId' not null" json:"PLN_ToyotaCalloff-ProductFamilyId"` - TotalQty int `xorm:"int 'TotalQty' not null" json:"PLN_ToyotaCalloff-TotalQty"` - CheckSequence int `xorm:"int 'CheckSequence' not null" json:"PLN_ToyotaCalloff-CheckSequence"` - Parsed int `xorm:"int 'Parsed' not null" json:"PLN_ToyotaCalloff-Parsed"` - OrderTime grmi.DateTime `xorm:"datetime 'OrderTime' not null" json:"PLN_ToyotaCalloff-OrderTime"` - OrderShift int `xorm:"int 'OrderShift' not null" json:"PLN_ToyotaCalloff-OrderShift"` - FileTime grmi.DateTime `xorm:"datetime 'FileTime' not null" json:"PLN_ToyotaCalloff-FileTime"` - EdiFile string `xorm:"nvarchar(100) 'EdiFile' not null" json:"PLN_ToyotaCalloff-EdiFile"` - EdiFileType string `xorm:"nvarchar(20) 'EdiFileType' not null" json:"PLN_ToyotaCalloff-EdiFileType"` - RecordId string `xorm:"nvarchar(40) 'RecordId' not null" json:"PLN_ToyotaCalloff-RecordId"` + PlantNr int `xorm:"pk int 'PlantNr'" json:"PLN_ToyotaCalloff-PlantNr"` + DemandId string `xorm:"pk nvarchar(40) 'DemandId'" json:"PLN_ToyotaCalloff-DemandId"` + SupplierCode string `xorm:"nvarchar(40) 'SupplierCode' not null" json:"PLN_ToyotaCalloff-SupplierCode"` + ProjectId string `xorm:"nvarchar(40) 'ProjectId' not null" json:"PLN_ToyotaCalloff-ProjectId"` + ProductFamilyId string `xorm:"nvarchar(40) 'ProductFamilyId' not null" json:"PLN_ToyotaCalloff-ProductFamilyId"` + TotalQty int `xorm:"int 'TotalQty' not null" json:"PLN_ToyotaCalloff-TotalQty"` + CheckSequence int `xorm:"int 'CheckSequence' not null" json:"PLN_ToyotaCalloff-CheckSequence"` + // 解析状态 1 代表已解析 2 代表已发运 + Parsed int `xorm:"int 'Parsed' not null" json:"PLN_ToyotaCalloff-Parsed"` + OrderTime grmi.DateTime `xorm:"datetime 'OrderTime' not null" json:"PLN_ToyotaCalloff-OrderTime"` + OrderShift int `xorm:"int 'OrderShift' not null" json:"PLN_ToyotaCalloff-OrderShift"` + FileTime grmi.DateTime `xorm:"datetime 'FileTime' not null" json:"PLN_ToyotaCalloff-FileTime"` + EdiFile string `xorm:"nvarchar(100) 'EdiFile' not null" json:"PLN_ToyotaCalloff-EdiFile"` + EdiFileType string `xorm:"nvarchar(20) 'EdiFileType' not null" json:"PLN_ToyotaCalloff-EdiFileType"` + RecordId string `xorm:"nvarchar(40) 'RecordId' not null" json:"PLN_ToyotaCalloff-RecordId"` // 校验状态 - CtrlPara1 int `xorm:"int 'CtrlPara1' not null" json:"PLN_ToyotaCalloff-CtrlPara1"` + CtrlPara1 int `xorm:"int 'CtrlPara1' not null" json:"PLN_ToyotaCalloff-CtrlPara1"` // 回冲状态 - CtrlPara2 int `xorm:"int 'CtrlPara2' not null" json:"PLN_ToyotaCalloff-CtrlPara2"` - CtrlStr1 string `xorm:"nvarchar(255) 'CtrlStr1' not null" json:"PLN_ToyotaCalloff-CtrlStr1"` - CtrlStr2 string `xorm:"nvarchar(255) 'CtrlStr2' not null" json:"PLN_ToyotaCalloff-CtrlStr2"` + CtrlPara2 int `xorm:"int 'CtrlPara2' not null" json:"PLN_ToyotaCalloff-CtrlPara2"` + CtrlStr1 string `xorm:"nvarchar(255) 'CtrlStr1' not null" json:"PLN_ToyotaCalloff-CtrlStr1"` + CtrlStr2 string `xorm:"nvarchar(255) 'CtrlStr2' not null" json:"PLN_ToyotaCalloff-CtrlStr2"` // 吊上 - CtrlStr3 string `xorm:"nvarchar(255) 'CtrlStr3' not null" json:"PLN_ToyotaCalloff-CtrlStr3"` + CtrlStr3 string `xorm:"nvarchar(255) 'CtrlStr3' not null" json:"PLN_ToyotaCalloff-CtrlStr3"` // 发运校验条码 樱泰为校验条码 安道拓为包装单条码 CheckBarcode string `xorm:"nvarchar(255) 'CheckBarcode' not null" json:"PLN_ToyotaCalloff-CheckBarcode"` // 校验时间 @@ -64,7 +65,6 @@ type ToyotaCalloffExcel struct { Parsed string `xorm:"int 'Parsed' not null" json:"PLN_ToyotaCalloff-Parsed"` OrderTime string `xorm:"datetime 'OrderTime' not null" json:"PLN_ToyotaCalloff-OrderTime"` OrderShift int `xorm:"int 'OrderShift' not null" json:"PLN_ToyotaCalloff-OrderShift"` - } /****************************************************************************** diff --git a/services/pln/implments/ToyotaCallOffCheck.impl.go b/services/pln/implments/ToyotaCallOffCheck.impl.go index 607f124..ff5a6c8 100644 --- a/services/pln/implments/ToyotaCallOffCheck.impl.go +++ b/services/pln/implments/ToyotaCallOffCheck.impl.go @@ -62,26 +62,22 @@ func (impl *ToyotaCalloffServiceImplement) Check(user *global.User, barcode stri return grmi.NewBusinessError("不存在待校验的顺引数据") } // 如果条码长度=14 且前8位是时间 则是樱泰条码 - isAdient := true - var checkBarcode string - if len(barcode) == 14 { + var plant string = "Adient" + if len(barcode) != 0 && strings.HasPrefix(barcode, "+") { + plant = "华智" + } else if len(barcode) == 14 { str := barcode[:8] _, err = time.Parse("20060102", str) if err == nil { - isAdient = false + plant = "樱泰" } } + + var checkBarcode string // 如果是樱泰 取后三位是配置 校验 - if !isAdient { - checkBarcode = barcode - productFamilyId := barcode[len(barcode)-3:] - if productFamilyId != nextCallOff.ProductFamilyId { - return grmi.NewBusinessError(fmt.Sprintf("当前条码配置%s和顺引配置%s不符", productFamilyId, nextCallOff.ProductFamilyId)) - } - if err = session.Begin(); err != nil { - return grmi.NewBusinessError("开启事务失败, 错误:" + err.Error()) - } - } else { // 如果是安道拓的 则校验包装单中所有座椅的配置 校验通过记录 校验状态和时间到包装单上 + switch plant { + case "Adient": + // 如果是安道拓的 则校验包装单中所有座椅的配置 校验通过记录 校验状态和时间到包装单上 productFamilyRelateDao := meDal.NewProductFamilyRelateDAO(session, user.PlantNr, user.UserId) packOrderItemDao := jitDal.NewPackOrderItemLstDAO(session, user.PlantNr, user.UserId) packOrderStatusDao := jitDal.NewPackOrderStatusDAO(session, user.PlantNr, user.UserId) @@ -163,6 +159,30 @@ func (impl *ToyotaCalloffServiceImplement) Check(user *global.User, barcode stri _ = session.Rollback() return err } + case "华智": + checkBarcode = barcode + var productFamilyId string + if len(barcode) > 5 { + productFamilyId = barcode[1:5] + } else { + return grmi.NewBusinessError(fmt.Sprintf("当前条码长度小于5位, 条码:%s", barcode)) + } + if productFamilyId != nextCallOff.ProductFamilyId { + return grmi.NewBusinessError(fmt.Sprintf("当前条码配置%s和顺引配置%s不符", productFamilyId, nextCallOff.ProductFamilyId)) + } + if err = session.Begin(); err != nil { + return grmi.NewBusinessError("开启事务失败, 错误:" + err.Error()) + } + + case "樱泰": + checkBarcode = barcode + productFamilyId := barcode[len(barcode)-3:] + if productFamilyId != nextCallOff.ProductFamilyId { + return grmi.NewBusinessError(fmt.Sprintf("当前条码配置%s和顺引配置%s不符", productFamilyId, nextCallOff.ProductFamilyId)) + } + if err = session.Begin(); err != nil { + return grmi.NewBusinessError("开启事务失败, 错误:" + err.Error()) + } } nextCallOff.CtrlPara1 = model.CALLOFF_STATUS_CHECKED nextCallOff.CtrlTime1 = grmi.DateTime(time.Now())