| | |
| | | |
| | | // 销售订单表 |
| | | type SEOrder struct { |
| | | FBillNo string `gorm:"column:FBillNo" json:"FBillNo"` // 编号 |
| | | FExplanation string `gorm:"column:FExplanation" json:"FExplanation"` // 摘要 |
| | | FBillNo string `gorm:"column:FBillNo" json:"FBillNo"` // 订单编号 |
| | | FNumber string `gorm:"column:FNumber" json:"FNumber"` // 产品代码 |
| | | FShortNumber string `gorm:"column:FShortNumber" json:"FShortNumber"` // 产品短代码, 客户图号 |
| | | FItemID string `gorm:"column:FItemID" json:"FItemID"` // 产品名称 |
| | | Fmodel string `gorm:"column:Fmodel" json:"Fmodel"` // 规格型号 |
| | | FUnitGroupID string `gorm:"column:FUnitGroupID" json:"FUnitGroupID"` // 基本单位 |
| | | FQty string `gorm:"column:FQty" json:"FQty"` // 基本单位数量 |
| | | FUnitID string `gorm:"column:FUnitID" json:"FUnitID"` // 单位 |
| | | Fauxqty float64 `gorm:"column:Fauxqty" json:"Fauxqty"` // 单位数量 |
| | | Fauxprice float64 `gorm:"column:Fauxprice" json:"Fauxprice"` // 单价 |
| | | Famount float64 `gorm:"column:Famount" json:"Famount"` // 金额 |
| | | FCess float64 `gorm:"column:FCess" json:"FCess"` // 税率 |
| | | FNote string `gorm:"column:FNote" json:"FNote"` // 备注 |
| | | FAdviceConsignDate string `gorm:"column:FAdviceConsignDate" json:"FAdviceConsignDate"` // 交货日期 |
| | | FCustID string `gorm:"column:FCustID" json:"FCustID"` // 购货单位 |
| | | FInventory float64 `gorm:"column:FInventory" json:"FInventory"` // 即时库存 |
| | | // 含税单价 |
| | | // 物料属性 |
| | | // 存货科目代码 |
| | | } |
| | | |
| | | //type SEOrder struct { |
| | | // FAreaPS int64 //销售范围 |
| | | // FBClosed int64 // |
| | | // FTranType int64 //单据类型 |
| | | // FUUID interface{} |
| | | // FBillerID int64 //制单: |
| | | // FBillNo string //编号: |
| | | // FBrID int64 //制单机构 |
| | | // FBrNo string //公司机构内码 |
| | | // FCancellation int64 //作废 |
| | | // FCashDiscount string // |
| | | // FCheckDate string //审核日期 |
| | | // FCheckerID int64 //审核人 |
| | | // FChildren int64 //关联标识 |
| | | // FClassTypeID int64 //事务类型 |
| | | // FClosed int64 //是否关闭 |
| | | // FCurCheckLevel int64 //当前审核级别 |
| | | // FCurrencyID int64 //币别: |
| | | // FCustID int64 //购货单位: |
| | | // FDate string //日期: |
| | | // FDeptID int64 //部门: |
| | | // FDiscountType int64 //折扣方式 |
| | | // FEmpID int64 //业务员: |
| | | // FExchangeRate float64 //汇 率: |
| | | // FExplanation string //摘要 |
| | | // FFetchAdd string //交货地点: |
| | | // FFetchDate string //交货日期: |
| | | // FFetchStyle string //交货方式: |
| | | // FImport int64 //引入标志 |
| | | // FInterID int64 //订单内码 |
| | | // FInvoiceClosed int64 // |
| | | // FManageType int64 //保税监管类型 |
| | | // FMangerID int64 //主管: |
| | | // FMultiCheckDate1 string //一级审核日期 |
| | | // FMultiCheckDate2 string //二级审核日期 |
| | | // FMultiCheckDate3 string //三级审核日期 |
| | | // FMultiCheckDate4 string //四级审核日期 |
| | | // FMultiCheckDate5 string //五级审核日期 |
| | | // FMultiCheckDate6 string //六级审核日期 |
| | | // FMultiCheckLevel1 int64 //一审: |
| | | // FMultiCheckLevel2 int64 //二审: |
| | | // FMultiCheckLevel3 int64 //三审: |
| | | // FMultiCheckLevel4 int64 //四审: |
| | | // FMultiCheckLevel5 int64 //五审: |
| | | // FMultiCheckLevel6 int64 //六审: |
| | | // FNote string //备注 |
| | | // FOperDate interface{} |
| | | // FOrderAffirm int64 //确认标志 |
| | | // FPayDate string //付款日期 |
| | | // FPayStyle string //付款方式: |
| | | // FPOOrdBillNo string //采购订单号: |
| | | // FRelateBrID int64 //订货机构: |
| | | // FSaleStyle int64 //销售方式: |
| | | // FSelTranType int64 //源单类型 |
| | | // FSettleDate string //结算日期 |
| | | // FSettleID int64 //结算方式: |
| | | // FStatus int64 //状态 |
| | | // FSystemType int64 // |
| | | // FTransitAheadTime float64 //运输提前期: |
| | | // FTranStatus int64 //传输标志 |
| | | //} |
| | | func SeOrderList() []SEOrder { |
| | | sql := ` |
| | | SELECT |
| | | i.FBillNo, |
| | | i.FNumber, |
| | | i.FShortNumber, |
| | | i.FItemID, |
| | | i.Fmodel, |
| | | i.FUnitGroupID, |
| | | i.FQty, |
| | | i.FUnitID, |
| | | i.Fauxqty, |
| | | i.Fauxprice, |
| | | i.Famount, |
| | | i.FCess, |
| | | i.FNote, |
| | | i.FAdviceConsignDate, |
| | | i.FCustID, |
| | | SUM(ICInventory.FQty) AS FInventory |
| | | FROM vwICBill_32 AS i |
| | | JOIN t_ICitem ON i.FShortNumber = t_ICitem.FShortNumber |
| | | JOIN ICInventory ON ICInventory.FItemID = t_ICitem.FItemID |
| | | GROUP BY |
| | | i.FBillNo, |
| | | i.FNumber, |
| | | i.FShortNumber, |
| | | i.FItemID, |
| | | i.Fmodel, |
| | | i.FUnitGroupID, |
| | | i.FQty, |
| | | i.FUnitID, |
| | | i.Fauxqty, |
| | | i.Fauxprice, |
| | | i.Famount, |
| | | i.FCess, |
| | | i.FNote, |
| | | i.FAdviceConsignDate, |
| | | i.FCustID; |
| | | ` |
| | | var result []SEOrder |
| | | |
| | | func (s SEOrder) TableName() string { |
| | | return "SEOrder" |
| | | } |
| | | db.Raw(sql).Debug().Scan(&result) |
| | | |
| | | func (s *SEOrder) FindAll() ([]SEOrder, error) { |
| | | var list []SEOrder |
| | | |
| | | err := db.Table(s.TableName()).Scan(&list).Error |
| | | |
| | | return list, err |
| | | } |
| | | |
| | | func (s *SEOrder) FindByFBillNo(fBillNo string) error { |
| | | |
| | | return db.Table(s.TableName()).Where("FBillNo = ?", fBillNo).Scan(s).Error |
| | | return result |
| | | } |